{"record":{"id":"fd329541500dcf18","repo":"cube-js/cube","slug":"errorstring","errorCode":null,"errorMessage":"errorString","messagePattern":"errorString","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"packages/cubejs-server-core/src/core/DevServer.ts","lineNumber":101,"sourceCode":"\n        // We don't know what state response is left at here:\n        // It could be corked, headers could be sent, body could be sent completely or partially\n\n        // Also, because we pass `next` to handler without any wrapper we don't know if it was called or not\n        // Hence, we shouldn't call it for error handling\n\n        try {\n          while (res.writableCorked > 0) {\n            res.uncork();\n          }\n\n          if (res.writableEnded) {\n            // There's nothing we can do for response, error happened after call to end()\n          } else if (res.headersSent) {\n            // If header is already sent, we can't alter any of it, so best we can do is just terminate body\n            res.end();\n          } else {\n            res.status(500).json({ error: errorString });\n          }\n        } catch (send500Error) {\n          const send500ErrorString = ((send500Error as Error).stack || send500Error).toString();\n          console.error(send500ErrorString);\n          this.cubejsServer.event('Dev Server Error', { error: send500ErrorString });\n          res.destroy(send500Error);\n        }\n      }\n    };\n\n    app.get('/playground/context', catchErrors((req, res) => {\n      this.cubejsServer.event('Dev Server Env Open');\n\n      res.json({\n        cubejsToken,\n        basePath: options.basePath,\n        anonymousId: getAnonymousId(),\n        coreServerVersion: this.cubejsServer.coreServerVersion,","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-server-core/src/core/DevServer.ts#L83-L119","documentation":"DevServer.catchErrors (packages/cubejs-server-core/src/core/DevServer.ts:101, wired by initDevEnv) wraps dev-server routes; when a handler throws, it logs the error and responds 500 with { error: errorString }. If headers were already sent it just ends the body; if sending the 500 itself fails it logs a secondary 'Dev Server Error'. The errorString is the stringified thrown error from any dev-server/playground endpoint.","triggerScenarios":"Any exception thrown inside a Dev Server route handler (playground pages, schema compilation preview, driver install, dashboard endpoints) that catchErrors intercepts.","commonSituations":"Broken schema files causing compile errors in playground endpoints; missing dashboard app assets; template-package installation failures during development.","solutions":["Read the `error` field of the 500 response / console output to find the underlying exception","Fix the root cause in your schema/dashboard files indicated by the error string","Disable the Dev Server in production (it is dev-only) if this fires in deployed environments","If the 500 itself fails to send ('Dev Server Error'), check for middleware that already wrote the response"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// client-side pattern for dev-server 500s\ntry {\n  const res = await fetch('/playground/...');\n  if (!res.ok) {\n    const body = await res.json();\n    console.error('Dev server error:', body.error);\n  }\n} catch (e) { /* network-level failure */ }","preventionTips":["Inspect the `error` field of the 500 body or dev-server console output first — it names the root cause","Fix schema/dashboard files flagged by the error string before retrying","Never enable the Dev Server in production","Avoid middleware that writes responses before dev-server handlers, which causes the nested send500Error path"],"tags":["dev-server","http-500","unhandled-exception"],"backgroundTag":"unhandled-exception-500","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}