tursodatabase/turso · error · DatabaseError
Unexpected describe response
Error message
Unexpected describe response
What it means
The pipeline response for describe() was HTTP-OK but not the expected shape: results missing or empty, or the first result neither an error nor a describe-typed response with a result. This is a protocol/shape mismatch between what the client expects and what the endpoint returned — not a SQL failure (that is the 'Describe execution failed' path).
Solutions
- Confirm the URL is a Turso database endpoint (turso db show --url) and not an app API or mock
- Upgrade @tursodatabase/serverless to the version matching your server/platform
- Capture the raw response (curl the /v3/pipeline endpoint) and compare against the expected PipelineResponse shape
- Disable any response-rewriting proxy while debugging
Defensive patterns
Strategy: validation
Validate before calling
// smoke-test that the endpoint speaks the pipeline protocol before relying on describe()
async function isTursoEndpoint(url: string): Promise<boolean> {
const res = await fetch(`${url.replace(/^(libsql|turso):\/\//, 'https://')}/v3/pipeline`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ baton: null, requests: [] }),
});
if (!res.ok) return false;
const json: any = await res.json();
return json && typeof json === 'object' && Array.isArray(json.results);
} Type guard
import { DatabaseError } from '@tursodatabase/serverless';
function isUnexpectedResponseShape(e: unknown): e is DatabaseError {
return e instanceof DatabaseError && e.message === 'Unexpected describe response';
} Try / catch
try { await session.describe(sql); }
catch (e) { if (isUnexpectedResponseShape(e)) throw new Error('endpoint is not a Turso pipeline server'); throw e; } Prevention
- Pin the client version to one tested against your server/platform
- Point configs only at Turso database URLs (from `turso db show --url`), never at app APIs or generic mocks
- Beware proxies that rewrite response bodies when debugging protocol-shape errors
When it happens
Trigger: Pointing the Session URL at a server that answers JSON but is not a Turso Hrana endpoint; a severe client/server version mismatch changing the pipeline response schema; a proxy or middleware rewriting the response body.
Common situations: Using a plain HTTP mock server or a different database's HTTP API at the configured URL; mixing an old serverless client with a newer server protocol; response-transforming debug proxies (mitm, devtools) corrupting the payload.
Related errors
- 1
- Batch execution failed
- batch response does not have one result and one error per…
- batch response does not have one result and one error per…
- batch response is missing the result for statement
AI-assisted analysis of tursodatabase/turso@c1e5928725 (2026-08-20).
Data as JSON: /api/errors/f0a95927e04ba2e1.
Report an issue: GitHub.
Appendix: source
Thrown at serverless/javascript/src/session.ts:247
this.baton = response.baton;
if (response.base_url) {
this.baseUrl = normalizeUrl(response.base_url);
}
this.updateAutocommit(response);
// Check for errors in the response
if (response.results && response.results[0]) {
const result = response.results[0];
if (result.type === "error") {
throw new DatabaseError(result.error?.message || 'Describe execution failed', result.error?.code);
}
if (result.response?.type === "describe" && result.response.result) {
return result.response.result as DescribeResult;
}
}
throw new DatabaseError('Unexpected describe response');
}
/**
* Execute a SQL statement and return all results.
*
* @param sql - The SQL statement to execute
* @param args - Optional array of parameter values or object with named parameters
* @param safeIntegers - Whether to return integers as BigInt
* @returns Promise resolving to the complete result set
*/
async execute(sql: string, args: any[] | Record<string, any> = [], safeIntegers: boolean = false, queryOptions?: QueryOptions): Promise<any> {
const { response, entries } = await this.executeRaw(sql, args, queryOptions);
const result = await this.processCursorEntries(entries, safeIntegers);
return result;
}
/**
* A trailing batch step gated on `is_autocommit`, appended to every cursorView on GitHub (pinned to c1e5928725)