If the function was invoked as part of an expression, then it returned more than one value. If a CALL invoked it, the number of expressions that follow the RETURN statement (in the function) was different from the number of variables that are listed in the RETURNING clause (in the CALL statement).
Check that the correct function was called. Review the logic of the function, especially its RETURN statements, to ensure that it always returns the expected number of values.