{"record":{"id":"c04cb59e706e8b82","repo":"cube-js/cube","slug":"value-value-is-not-valid-for-cubejs-max-reque","errorCode":null,"errorMessage":"Value \"${value}\" is not valid for CUBEJS_MAX_REQUEST_SIZE. Must be between 100kb and 64mb.","messagePattern":"Value \"(.+?)\" is not valid for CUBEJS_MAX_REQUEST_SIZE\\. Must be between 100kb and 64mb\\.","errorType":"validation","errorClass":"InvalidConfiguration","httpStatus":null,"severity":"error","filePath":"packages/cubejs-backend-shared/src/env.ts","lineNumber":235,"sourceCode":"  tls: () => get('CUBEJS_ENABLE_TLS')\n    .default('false')\n    .asBoolStrict(),\n  webSockets: () => get('CUBEJS_WEB_SOCKETS')\n    .default('false')\n    .asBoolStrict(),\n  serverHeadersTimeout: () => get('CUBEJS_SERVER_HEADERS_TIMEOUT')\n    .asInt(),\n  serverKeepAliveTimeout: () => get('CUBEJS_SERVER_KEEP_ALIVE_TIMEOUT')\n    .asInt(),\n  maxRequestSize: () => {\n    const value = process.env.CUBEJS_MAX_REQUEST_SIZE || '50mb';\n    const bytes = convertSizeToBytes(value, 'CUBEJS_MAX_REQUEST_SIZE');\n\n    const minBytes = 100 * 1024; // 100kb\n    const maxBytes = 64 * 1024 * 1024; // 64mb\n\n    if (bytes < minBytes || bytes > maxBytes) {\n      throw new InvalidConfiguration(\n        'CUBEJS_MAX_REQUEST_SIZE',\n        value,\n        'Must be between 100kb and 64mb.'\n      );\n    }\n\n    return bytes;\n  },\n  rollupOnlyMode: () => get('CUBEJS_ROLLUP_ONLY')\n    .default('false')\n    .asBoolStrict(),\n  schemaPath: () => get('CUBEJS_SCHEMA_PATH')\n    .default('model')\n    .asString(),\n  refreshWorkerMode: () => {\n    const refreshWorkerMode = get('CUBEJS_REFRESH_WORKER').asBool();\n    if (refreshWorkerMode !== undefined) {\n      return refreshWorkerMode;","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-backend-shared/src/env.ts#L217-L253","documentation":"Cube validates CUBEJS_MAX_REQUEST_SIZE and rejects values that convert to fewer than 100KB or more than 64MB, throwing an InvalidConfiguration error. This guards the HTTP request body limit against unusable or unsafe values.","triggerScenarios":"Setting CUBEJS_MAX_REQUEST_SIZE to a value out of range, e.g. '10kb', '1kb', '100mb', or an empty/invalid string that converts to 0 bytes via convertSizeToBytes.","commonSituations":"Admins trying to shrink the limit below 100kb for security, or raise it above 64mb for large queries; a unit typo like '64k' instead of '64mb'; whitespace/garbage values.","solutions":["Set CUBEJS_MAX_REQUEST_SIZE to a value between 100kb and 64mb, e.g. '10mb'.","Use explicit units (kb/mb) so convertSizeToBytes parses the value correctly.","If you need a limit above 64mb, front Cube with a proxy (nginx/ALB) that allows larger bodies instead of this env var.","Verify the value with a quick conversion (e.g. 64 * 1024 * 1024 bytes = 67108864) before deploying."],"exampleFix":"// before\nCUBEJS_MAX_REQUEST_SIZE=500kb  // throws: below 100kb? no, ok; but 50kb would throw\nCUBEJS_MAX_REQUEST_SIZE=50kb\n// after\nCUBEJS_MAX_REQUEST_SIZE=10mb","handlingStrategy":"validation","validationCode":"const MAX = 64 * 1024 * 1024, MIN = 100 * 1024;\nfunction parseSize(v) {\n  const m = /^(\\d+)\\s*(kb|mb)?$/i.exec(String(v).trim());\n  if (!m) return null;\n  const n = +m[1] * (m[2]?.toLowerCase() === 'mb' ? 1024 * 1024 : m[2] ? 1024 : 1);\n  return n >= MIN && n <= MAX ? n : null;\n}\nif (process.env.CUBEJS_MAX_REQUEST_SIZE && parseSize(process.env.CUBEJS_MAX_REQUEST_SIZE) === null)\n  throw new Error('CUBEJS_MAX_REQUEST_SIZE must be between 100kb and 64mb');","typeGuard":null,"tryCatchPattern":"try {\n  startServer();\n} catch (e) {\n  if (String(e.message).includes('CUBEJS_MAX_REQUEST_SIZE')) {\n    console.error('Fix CUBEJS_MAX_REQUEST_SIZE: use values like 10mb (range 100kb-64mb)');\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Always include explicit kb/mb units.","Keep the value within 100kb-64mb; enforce larger limits at a reverse proxy instead.","Validate env files in CI before deploy."],"tags":["configuration","environment-variables","validation"],"backgroundTag":"invalid-env-var-value","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}