{"record":{"id":"f0a95927e04ba2e1","repo":"tursodatabase/turso","slug":"unexpected-describe-response","errorCode":null,"errorMessage":"Unexpected describe response","messagePattern":"Unexpected describe response","errorType":"exception","errorClass":"DatabaseError","httpStatus":null,"severity":"error","filePath":"serverless/javascript/src/session.ts","lineNumber":247,"sourceCode":"    this.baton = response.baton;\n    if (response.base_url) {\n      this.baseUrl = normalizeUrl(response.base_url);\n    }\n    this.updateAutocommit(response);\n\n    // Check for errors in the response\n    if (response.results && response.results[0]) {\n      const result = response.results[0];\n      if (result.type === \"error\") {\n        throw new DatabaseError(result.error?.message || 'Describe execution failed', result.error?.code);\n      }\n\n      if (result.response?.type === \"describe\" && result.response.result) {\n        return result.response.result as DescribeResult;\n      }\n    }\n\n    throw new DatabaseError('Unexpected describe response');\n  }\n\n  /**\n   * Execute a SQL statement and return all results.\n   *\n   * @param sql - The SQL statement to execute\n   * @param args - Optional array of parameter values or object with named parameters\n   * @param safeIntegers - Whether to return integers as BigInt\n   * @returns Promise resolving to the complete result set\n   */\n  async execute(sql: string, args: any[] | Record<string, any> = [], safeIntegers: boolean = false, queryOptions?: QueryOptions): Promise<any> {\n    const { response, entries } = await this.executeRaw(sql, args, queryOptions);\n    const result = await this.processCursorEntries(entries, safeIntegers);\n    return result;\n  }\n\n  /**\n   * A trailing batch step gated on `is_autocommit`, appended to every cursor","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/tursodatabase/turso/blob/c1e59287258d99b309e362a63f48822256e2f65f/serverless/javascript/src/session.ts#L229-L265","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// smoke-test that the endpoint speaks the pipeline protocol before relying on describe()\nasync function isTursoEndpoint(url: string): Promise<boolean> {\n  const res = await fetch(`${url.replace(/^(libsql|turso):\\/\\//, 'https://')}/v3/pipeline`, {\n    method: 'POST',\n    headers: { 'Content-Type': 'application/json' },\n    body: JSON.stringify({ baton: null, requests: [] }),\n  });\n  if (!res.ok) return false;\n  const json: any = await res.json();\n  return json && typeof json === 'object' && Array.isArray(json.results);\n}","typeGuard":"import { DatabaseError } from '@tursodatabase/serverless';\n\nfunction isUnexpectedResponseShape(e: unknown): e is DatabaseError {\n  return e instanceof DatabaseError && e.message === 'Unexpected describe response';\n}","tryCatchPattern":"try { await session.describe(sql); }\ncatch (e) { if (isUnexpectedResponseShape(e)) throw new Error('endpoint is not a Turso pipeline server'); throw e; }","preventionTips":["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"],"tags":["protocol","response-shape","typescript"],"backgroundTag":"unexpected-response-format","analyzedSha":"c1e59287258d99b309e362a63f48822256e2f65f","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}