{"record":{"id":"afb1749287f45c4b","repo":"cube-js/cube","slug":"support-for-user-context-was-removed-please-migra","errorCode":null,"errorMessage":"Support for USER_CONTEXT was removed, please migrate to SECURITY_CONTEXT.","messagePattern":"Support for USER_CONTEXT was removed, please migrate to SECURITY_CONTEXT\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-schema-compiler/src/compiler/CubeSymbols.ts","lineNumber":1405,"sourceCode":"              },\n              toString() {\n                return '';\n              }\n            })\n          })\n        });\n      }\n    });\n  }\n\n  protected filterGroupFunctionDep() {\n    return (...filterParamArgs) => '';\n  }\n\n  public resolveSymbol(cubeName, name: string) {\n    const { sqlResolveFn, contextSymbols, collectJoinHints, depsResolveFn, currResolveIndexFn } = this.resolveSymbolsCallContext || {};\n    if (name === 'USER_CONTEXT') {\n      throw new Error('Support for USER_CONTEXT was removed, please migrate to SECURITY_CONTEXT.');\n    }\n\n    if (CONTEXT_SYMBOLS[name]) {\n      // always resolves if contextSymbols aren't passed for transpile step\n      const symbol = contextSymbols?.[CONTEXT_SYMBOLS[name]] || {};\n      // eslint-disable-next-line no-underscore-dangle\n      symbol._objectWithResolvedProperties = true;\n      return symbol;\n    }\n\n    // In proxied subProperty flow `name` will be set to parent dimension|measure name,\n    // so there will be no cube = this.symbols[cubeName : name] found, but potentially\n    // during cube definition evaluation some other deeper subProperty may be requested.\n    // To distinguish such cases we pass the right now requested property name to\n    // cubeReferenceProxy, so later if subProperty is requested we'll have all the required\n    // information to construct the response.\n    let cube = this.symbols[this.isCurrentCube(name) ? cubeName : name];\n    if (sqlResolveFn) {","sourceCodeStart":1387,"sourceCodeEnd":1423,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-schema-compiler/src/compiler/CubeSymbols.ts#L1387-L1423","documentation":"The old SECURITY_CONTEXT predecessor symbol USER_CONTEXT was removed from the schema compiler. resolveSymbol throws this Error when a data model references USER_CONTEXT so the author migrates to SECURITY_CONTEXT. There is no fallback: the symbol no longer resolves.","triggerScenarios":"A cube/view/join SQL or filter references `${USER_CONTEXT.something}` (e.g. `filter: { sql: '\\${CUBE}.userId = \\'\\${USER_CONTEXT.id}\\'' }`). Compilation calls resolveSymbol('USER_CONTEXT') and throws immediately.","commonSituations":"Upgrading an old Cube project from a pre-SECURITY_CONTEXT version; copying legacy schema examples from old tutorials; multi-tenant filters written years ago never migrated.","solutions":["Replace every USER_CONTEXT reference with SECURITY_CONTEXT in all data model files.","Verify the security context keys you access exist in your JWT/security context (SECURITY_CONTEXT is null-safe but keys must match).","Search the repository for `USER_CONTEXT` and run the test suite to confirm compilation succeeds."],"exampleFix":"// before\nfilter: { sql: `\\${CUBE}.tenantId = '\\${USER_CONTEXT.tenantId}'` }\n// after\nfilter: { sql: `\\${CUBE}.tenantId = '\\${SECURITY_CONTEXT.tenantId}'` }","handlingStrategy":"validation","validationCode":"grep -rn 'USER_CONTEXT' schema/ && echo 'Found legacy USER_CONTEXT usage - migrate to SECURITY_CONTEXT'","typeGuard":null,"tryCatchPattern":"try { await compiler.compile(); } catch (e) { if (/USER_CONTEXT was removed/.test(e.message)) { console.error('Migrate USER_CONTEXT -> SECURITY_CONTEXT'); } throw e; }","preventionTips":["Add a lint/grep rule banning USER_CONTEXT in schema folders","Review release notes before major upgrades","Use SECURITY_CONTEXT in all new data models"],"tags":["schema-compiler","breaking-change","security-context","migration"],"backgroundTag":"removed-api-symbol","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}