{"id":"e2d7e7abb70b89e7","repo":"drizzle-team/drizzle-orm","slug":"unknown-type-type","errorCode":null,"errorMessage":"Unknown type: ${type}","messagePattern":"Unknown type: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-kit/src/serializer/studio.ts","lineNumber":828,"sourceCode":"\n\t\t\t\tif (!found) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Custom default not found for ${column.schema}.${column.table}.${column.column}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst value = found.func();\n\n\t\t\t\treturn {\n\t\t\t\t\t...column,\n\t\t\t\t\tvalue,\n\t\t\t\t};\n\t\t\t});\n\n\t\t\treturn c.json(JSON.parse(jsonStringify(result)));\n\t\t}\n\n\t\tthrow new Error(`Unknown type: ${type}`);\n\t});\n\n\treturn {\n\t\tstart: (params: Parameters<Server['start']>[0]) => {\n\t\t\tserve(\n\t\t\t\t{\n\t\t\t\t\tfetch: app!.fetch,\n\t\t\t\t\tcreateServer: params.key ? createServer : undefined,\n\t\t\t\t\thostname: params.host,\n\t\t\t\t\tport: params.port,\n\t\t\t\t\tserverOptions: {\n\t\t\t\t\t\tkey: params.key,\n\t\t\t\t\t\tcert: params.cert,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t() => params.cb(null, `${params.host}:${params.port}`),\n\t\t\t);\n\t\t},","sourceCodeStart":810,"sourceCodeEnd":846,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-kit/src/serializer/studio.ts#L810-L846","documentation":"The Studio Hono server receives a JSON body with a `type` discriminator (`init`, `proxy`, `tproxy`, `defaults`). Reaching the final `throw new Error('Unknown type: ${type}')` means the request's `type` matched none of the handlers — i.e. the Studio frontend sent a message variant the running server does not understand.","triggerScenarios":"A version skew between the Studio frontend (shipped via `drizzle-kit`) and the Studio backend server, or a hand-crafted/curl request to the Studio HTTP endpoint with an unsupported `type` field.","commonSituations":"Caching an old Studio web UI in the browser while running a newer/older `drizzle-kit`, or a partial upgrade where the CLI and the cached UI diverge.","solutions":["Hard-refresh the Studio browser tab (clear cache) to load the UI matching the current drizzle-kit.","Reinstall/upgrade `drizzle-kit` to a single coherent version.","Avoid sending manual requests to the Studio HTTP endpoint; only the bundled UI should call it."],"exampleFix":"// not a code fix - clear browser cache / restart studio\n// kill the process and re-run:\n// npx drizzle-kit studio","handlingStrategy":"validation","validationCode":"// Only the bundled Studio UI should call the server; guard request type\nconst KNOWN = new Set(['init', 'proxy', 'tproxy', 'defaults']);\nfunction assertKnownType(t: string) { if (!KNOWN.has(t)) throw new Error('Bad type'); }","typeGuard":"function isStudioMessageType(t: unknown): t is 'init' | 'proxy' | 'tproxy' | 'defaults' {\n  return typeof t === 'string' && ['init', 'proxy', 'tproxy', 'defaults'].includes(t);\n}","tryCatchPattern":"// Not catchable client-side; the fix is to align versions.\n// Restart studio and hard-refresh the browser if seen.","preventionTips":["Keep drizzle-kit as the single source of the Studio UI+server.","Disable the browser cache for the Studio tab."],"tags":["drizzle-kit","studio","version-skew"],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}