Title: ERROR api.chat DataStream onError triggered: TypeError: Cannot read properties of undefined (reading 'typeName') · Issue #69 · codinit-dev/codinit-dev · GitHub
Open Graph Title: ERROR api.chat DataStream onError triggered: TypeError: Cannot read properties of undefined (reading 'typeName') · Issue #69 · codinit-dev/codinit-dev
X Title: ERROR api.chat DataStream onError triggered: TypeError: Cannot read properties of undefined (reading 'typeName') · Issue #69 · codinit-dev/codinit-dev
Description: What happened? while rendering response, browser reports error Error Details: Custom error: Cannot read properties of undefined (reading 'typeName') How to reproduce http://localhost:5173/chat/1 enter a request/prompt wait for response.....
Open Graph Description: What happened? while rendering response, browser reports error Error Details: Custom error: Cannot read properties of undefined (reading 'typeName') How to reproduce http://localhost:5173/chat/1 en...
X Description: What happened? while rendering response, browser reports error Error Details: Custom error: Cannot read properties of undefined (reading 'typeName') How to reproduce http://localhost:5173/c...
Opengraph URL: https://github.com/codinit-dev/codinit-dev/issues/69
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ERROR api.chat DataStream onError triggered: TypeError: Cannot read properties of undefined (reading 'typeName')","articleBody":"### What happened?\n\nwhile rendering response, browser reports error \nError Details: Custom error: Cannot read properties of undefined (reading 'typeName')\n\n### How to reproduce\n\n1. http://localhost:5173/chat/1\n2. enter a request/prompt\n3. wait for response... interupted by reported error\n\n### Environment\n\nchrome\nwindows\nollama: local http://127.0.0.1:11434/\nversion 1.2.3\n\n### Extra info\n\naccording to copilot there's an error with the following\n\nThe error is in zod-to-json-schema when it tries to parse tool definitions. The issue is that one of the tool schemas passed to [streamText](vscode-file://vscode-app/c:/Users/antho/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html) is invalid or not a proper Zod schema.\n\nThe error happens in prepareToolsAndToolChoice when the AI SDK tries to convert tool schemas. Let me check how tools are being provided to streamText:\n\nThe issue is on line 224: [const builtInTools = builtInToolService.toolsWithoutExecute;]\n\nThe problem is that [toolsWithoutExecute] is returning tool objects that don't have valid Zod schemas. Let me check the BuiltInToolService to see the tool definitions:\n\nThe JSON has valid parameter schemas. But the issue is that when these are loaded, they're just plain JSON objects, not Zod schemas. The AI SDK expects Zod schemas, not plain JSON schemas.\n\nThe fix is to not pass tools if they don't have valid Zod schemas, or to validate them first. Let me add a check:\n\nThe issue was that the built-in tools defined in the JSON file have JSON schemas (not Zod schemas), and when the AI SDK tries to convert them to JSON schema for tool validation, it fails because the structure isn't compatible.\n\nThe fix disables the built-in tools that are loaded from JSON since they're not proper Zod schemas. The actual tool execution is still handled through the [processToolInvocations] method on the server side, so functionality isn't lost.\n\n_stream-text.ts_\n if (Object.keys(builtInTools).length \u003e 0) {\n\nremove... allTools ={ ...allTools, ...builtInTools };\nremove... logger.info(`Added ${Object.keys(...\n\nadd... logger.info(`Filtering built-in tools - checking for valid schemas`);\nadd... const validBuiltInTools: Record\u003cstring, any\u003e = {};\nadd... \nadd... for (const [toolName, toolDef] of Object.entries(builtInTools)) {\nadd... // Only include tools that have proper definitions (not just JSON schemas)\nadd... // Built-in tools from JSON don't have Zod validation, so we skip them for now\nadd... // and rely on MCP and server-side tool processing instead\nadd... logger.debug(`Skipping built-in tool ${toolName} - JSON schemas not compatible with AI SDK tool format`);\nadd... }\nadd... \nadd... if (Object.keys(validBuiltInTools).length \u003e 0) {\nadd... allTools = { ...allTools, ...validBuiltInTools };\nadd... logger.info(`Added ${Object.keys(validBuiltInTools).length} valid built-in tools`);\nadd... } else {\nadd... logger.info(`No valid built-in tools with proper schemas found for this model`);\nadd... }\nadd... }","author":{"url":"https://github.com/ambbone","@type":"Person","name":"ambbone"},"datePublished":"2026-01-15T22:11:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/69/codinit-dev/issues/69"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:743c006e-fcea-40b2-3f06-ffd7f991cb20 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B5B8:E0442:6F9791:9214D5:698EB0CF |
| html-safe-nonce | f1382f1a497acb980cb855b9c4e55308f63a1aea81b39b980d31abcd0d9feadc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNUI4OkUwNDQyOjZGOTc5MTo5MjE0RDU6Njk4RUIwQ0YiLCJ2aXNpdG9yX2lkIjoiMzc3MTE0Mjk4MDI5Mjc1MTU2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b701c429abe9c1314c3cd26e3ca45b614a526ff472498c44c8066978aab297d0 |
| hovercard-subject-tag | issue:3819401815 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/codinit-dev/codinit-dev/69/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0aac162c9fc79ca2c64a34fd05fada5169da22758095768e2ede0abd92bb6edd/codinit-dev/codinit-dev/issues/69 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0aac162c9fc79ca2c64a34fd05fada5169da22758095768e2ede0abd92bb6edd/codinit-dev/codinit-dev/issues/69 |
| og:image:alt | What happened? while rendering response, browser reports error Error Details: Custom error: Cannot read properties of undefined (reading 'typeName') How to reproduce http://localhost:5173/chat/1 en... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ambbone |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb2828a801ee6b7be618f3ac76fbf55def35bbc30f053a9c41bf90210b8b72ba |
| turbo-cache-control | no-preview |
| go-import | github.com/codinit-dev/codinit-dev git https://github.com/codinit-dev/codinit-dev.git |
| octolytics-dimension-user_id | 216432367 |
| octolytics-dimension-user_login | codinit-dev |
| octolytics-dimension-repository_id | 1069539460 |
| octolytics-dimension-repository_nwo | codinit-dev/codinit-dev |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1069539460 |
| octolytics-dimension-repository_network_root_nwo | codinit-dev/codinit-dev |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6b91a7e6e46287d26887e3fb7a4161657bab8f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width