cube-js/cube · error · Error
ksql API error for '${body.ksql}': ${(<any>e).response?.data
Error message
ksql API error for '${body.ksql}': ${(<any>e).response?.data?.message || (<any>e).response?.statusCode || (<any>e).message || (<any>e).toString()} What it means
apiQuery wraps any axios failure against the ksql REST endpoint (auth errors, wrong URL/port, ksqlDB server errors, network failures) into a single error that embeds the submitted KSQL statement and the best available server-provided detail (response.data.message, status code, or axios error). It marks the failure as a ksqlDB API problem for the given statement, not a Cube-side compilation issue.
Source
Thrown at packages/cubejs-ksql-driver/src/KsqlDriver.ts:156
mechanism: 'plain',
username: this.config.kafkaUser,
password: this.config.kafkaPassword || ''
} : undefined,
});
}
}
private async apiQuery(path: string, body: any): Promise<AxiosResponse> {
const url = `${this.config.url}${path}`;
try {
return await axios.post(url, body, {
auth: {
username: this.config.username,
password: this.config.password,
},
});
} catch (e) {
throw new Error(
`ksql API error for '${
body.ksql
}': ${
(<any>e).response?.data?.message ||
(<any>e).response?.statusCode ||
(<any>e).message ||
(<any>e).toString()
}`
);
}
}
protected prepareQueryWithParams(query: string, values?: unknown[]): string {
return formatAnsi(query, values || []);
}
public async query<R = unknown>(query: string, values?: unknown[], options: KsqlQueryOptions = {}): Promise<R> {
if (query.toLowerCase().startsWith('select')) {View on GitHub (pinned to 7d981676b3)
Solutions
- Check e.response.data.message first for the ksqlDB server error text (syntax error, unknown stream/table, auth failure) and fix the ksql statement accordingly
- Verify this.config.url, username and password are correct and the ksql server is reachable
- If e.response.statusCode is present (e.g. 401/403), fix authentication; if the message is a connect error, fix the URL/network
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/cubejs-ksql-driver/src/KsqlDriver.ts:156 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/accae2fe644c3ffa.
Report an issue: GitHub.