cube-js/cube · error
Unexpected output parameter value '${payload.output}'
Error message
Unexpected output parameter value '${payload.output}' What it means
The /v1/convert endpoint only supports `output: 'rest'` (a SQL string converted to a Cube REST/JSON query). convertQuery throws this Error when the `output` parameter is anything else. Like the input check, it guards the single supported conversion direction.
Source
Thrown at packages/cubejs-api-gateway/src/gateway.ts:1787
...query,
timeDimensions: query.timeDimensions || [],
contextSymbols: {
securityContext: this.securityContextExtractor(context),
},
requestId: context.requestId
};
}
protected async convertQuery({ payload, context, res }: QueryConvertRequest) {
try {
await this.assertApiScope('sql', context.securityContext);
if (payload.input !== 'sql') {
throw new Error(`Unexpected input parameter value '${payload.input}'`);
}
if (payload.output !== 'rest') {
throw new Error(`Unexpected output parameter value '${payload.output}'`);
}
if (typeof payload.query !== 'string' || !payload.query.trim()) {
throw new Error('query parameter must be a non-empty string');
}
const result = await this.sqlServer.rest4sql(payload.query, context.securityContext);
await res(result);
} catch (e: any) {
this.handleError({
e,
context,
query: payload,
res,
});
}
}View on GitHub (pinned to 7d981676b3)
Solutions
- Set `output` to exactly 'rest' in the request body.
- Remember the endpoint's sole purpose is SQL -> REST query conversion; for the reverse direction use the /v1/sql endpoint instead.
- Check for typos/casing: the accepted literal is lowercase 'rest'.
Example fix
// before
{ input: 'sql', output: 'sql', query: 'SELECT count(*) FROM orders' }
// after
{ input: 'sql', output: 'rest', query: 'SELECT count(*) FROM orders' } Defensive patterns
Strategy: validation
Validate before calling
if (body.output !== 'rest') throw new Error(`/v1/convert requires output:'rest', got ${JSON.stringify(body.output)}`); Type guard
function isConvertOutput(v: unknown): v is 'rest' { return v === 'rest'; } Try / catch
try {
return await convertEndpoint(body);
} catch (e) {
if (String(e?.message).startsWith('Unexpected output parameter')) {
return await convertEndpoint({ ...body, output: 'rest' });
}
throw e;
} Prevention
- Use a typed helper wrapping /v1/convert that hardcodes output:'rest'.
- Do not mirror the input value into output.
- For REST->SQL conversion use the /v1/sql endpoint instead.
When it happens
Trigger: POST /cubejs-api/v1/convert with body { input: 'sql', output: 'sql' | 'graphql' | 'json' | anything other than 'rest', query: 'SELECT ...' }.
Common situations: Assuming the endpoint can convert REST -> SQL as well (it cannot); passing output mirroring input ('sql' -> 'sql'); IDE extensions or tools generating a wrong default output field.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Unexpected input parameter value '${payload.input}'
- query parameter must be a non-empty string
- Can't parse date: '${from}'
- Can't parse date: '${to}'
- Can't parse date: '${dateString}'
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/2a89bc5b85193ca8.
Report an issue: GitHub.