cube-js/cube · error
Unexpected input parameter value '${payload.input}'
Error message
Unexpected input parameter value '${payload.input}' What it means
The /v1/convert (query convert) endpoint only accepts `input: 'sql'`. If the payload's `input` parameter is anything else, convertQuery throws this Error (not a UserError), which surfaces as a 500-class handler error. The endpoint exists to translate a SQL string into the equivalent Cube REST query (`output: 'rest'`), so only one input format is valid.
Source
Thrown at packages/cubejs-api-gateway/src/gateway.ts:1783
}
protected coerceForSqlQuery(query, context: Readonly<RequestContext>) {
return {
...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,View on GitHub (pinned to 7d981676b3)
Solutions
- Set `input` to exactly 'sql' in the request body.
- Verify the value is lowercase 'sql' (no extra whitespace or casing variants).
- If you need another conversion direction, use the appropriate endpoint — /v1/convert only supports sql -> rest.
Example fix
// before
await fetch('/cubejs-api/v1/convert', { method:'POST', body: JSON.stringify({ input: 'rest', output: 'rest', query: sql }) });
// after
await fetch('/cubejs-api/v1/convert', { method:'POST', body: JSON.stringify({ input: 'sql', output: 'rest', query: sql }) }); Defensive patterns
Strategy: validation
Validate before calling
if (body.input !== 'sql') throw new Error(`/v1/convert requires input:'sql', got ${JSON.stringify(body.input)}`); Type guard
function isConvertInput(v: unknown): v is 'sql' { return v === 'sql'; } Try / catch
try {
return await convertEndpoint(body);
} catch (e) {
if (String(e?.message).startsWith('Unexpected input parameter')) {
return await convertEndpoint({ ...body, input: 'sql' });
}
throw e;
} Prevention
- Freeze the convert request body as a constant with input:'sql'.
- Type the payload as { input: 'sql'; output: 'rest'; query: string } in TypeScript.
- Remember /v1/convert only converts SQL to REST queries.
When it happens
Trigger: POST /cubejs-api/v1/convert with body { input: 'graphql' | 'rest' | 'mdx' | anything other than 'sql', output: 'rest', query: '...' }.
Common situations: Typo or casing mistake in the input field; assuming the endpoint is a general-purpose converter; copy-pasting an integration snippet written for a different endpoint.
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 output parameter value '${payload.output}'
- 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/d54b39f6d8b83a7d.
Report an issue: GitHub.