{"record":{"id":"d54b39f6d8b83a7d","repo":"cube-js/cube","slug":"unexpected-input-parameter-value-payload-input","errorCode":null,"errorMessage":"Unexpected input parameter value '${payload.input}'","messagePattern":"Unexpected input parameter value '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-api-gateway/src/gateway.ts","lineNumber":1783,"sourceCode":"  }\n\n  protected coerceForSqlQuery(query, context: Readonly<RequestContext>) {\n    return {\n      ...query,\n      timeDimensions: query.timeDimensions || [],\n      contextSymbols: {\n        securityContext: this.securityContextExtractor(context),\n      },\n      requestId: context.requestId\n    };\n  }\n\n  protected async convertQuery({ payload, context, res }: QueryConvertRequest) {\n    try {\n      await this.assertApiScope('sql', context.securityContext);\n\n      if (payload.input !== 'sql') {\n        throw new Error(`Unexpected input parameter value '${payload.input}'`);\n      }\n\n      if (payload.output !== 'rest') {\n        throw new Error(`Unexpected output parameter value '${payload.output}'`);\n      }\n\n      if (typeof payload.query !== 'string' || !payload.query.trim()) {\n        throw new Error('query parameter must be a non-empty string');\n      }\n\n      const result = await this.sqlServer.rest4sql(payload.query, context.securityContext);\n\n      await res(result);\n    } catch (e: any) {\n      this.handleError({\n        e,\n        context,\n        query: payload,","sourceCodeStart":1765,"sourceCodeEnd":1801,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-api-gateway/src/gateway.ts#L1765-L1801","documentation":"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.","triggerScenarios":"POST /cubejs-api/v1/convert with body { input: 'graphql' | 'rest' | 'mdx' | anything other than 'sql', output: 'rest', query: '...' }.","commonSituations":"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.","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."],"exampleFix":"// before\nawait fetch('/cubejs-api/v1/convert', { method:'POST', body: JSON.stringify({ input: 'rest', output: 'rest', query: sql }) });\n// after\nawait fetch('/cubejs-api/v1/convert', { method:'POST', body: JSON.stringify({ input: 'sql', output: 'rest', query: sql }) });","handlingStrategy":"validation","validationCode":"if (body.input !== 'sql') throw new Error(`/v1/convert requires input:'sql', got ${JSON.stringify(body.input)}`);","typeGuard":"function isConvertInput(v: unknown): v is 'sql' { return v === 'sql'; }","tryCatchPattern":"try {\n  return await convertEndpoint(body);\n} catch (e) {\n  if (String(e?.message).startsWith('Unexpected input parameter')) {\n    return await convertEndpoint({ ...body, input: 'sql' });\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["rest-api","parameter-validation","sql-api"],"backgroundTag":"invalid-argument-value","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}