cube-js/cube · error

errorString

Error message

errorString

What it means

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.

Source

Thrown at packages/cubejs-server-core/src/core/DevServer.ts:101

        // We don't know what state response is left at here:
        // It could be corked, headers could be sent, body could be sent completely or partially

        // Also, because we pass `next` to handler without any wrapper we don't know if it was called or not
        // Hence, we shouldn't call it for error handling

        try {
          while (res.writableCorked > 0) {
            res.uncork();
          }

          if (res.writableEnded) {
            // There's nothing we can do for response, error happened after call to end()
          } else if (res.headersSent) {
            // If header is already sent, we can't alter any of it, so best we can do is just terminate body
            res.end();
          } else {
            res.status(500).json({ error: errorString });
          }
        } catch (send500Error) {
          const send500ErrorString = ((send500Error as Error).stack || send500Error).toString();
          console.error(send500ErrorString);
          this.cubejsServer.event('Dev Server Error', { error: send500ErrorString });
          res.destroy(send500Error);
        }
      }
    };

    app.get('/playground/context', catchErrors((req, res) => {
      this.cubejsServer.event('Dev Server Env Open');

      res.json({
        cubejsToken,
        basePath: options.basePath,
        anonymousId: getAnonymousId(),
        coreServerVersion: this.cubejsServer.coreServerVersion,

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Read the `error` field of the 500 response / console output to find the underlying exception
  2. Fix the root cause in your schema/dashboard files indicated by the error string
  3. Disable the Dev Server in production (it is dev-only) if this fires in deployed environments
  4. If the 500 itself fails to send ('Dev Server Error'), check for middleware that already wrote the response
Defensive patterns

Strategy: try-catch

Try / catch

// client-side pattern for dev-server 500s
try {
  const res = await fetch('/playground/...');
  if (!res.ok) {
    const body = await res.json();
    console.error('Dev server error:', body.error);
  }
} catch (e) { /* network-level failure */ }

Prevention

When it happens

Trigger: Any exception thrown inside a Dev Server route handler (playground pages, schema compilation preview, driver install, dashboard endpoints) that catchErrors intercepts.

Common situations: Broken schema files causing compile errors in playground endpoints; missing dashboard app assets; template-package installation failures during development.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/fd329541500dcf18. Report an issue: GitHub.