{"record":{"id":"cc87abc3a5b7c76e","repo":"paperclipai/paperclip","slug":"managed-config-env-key-detail","errorCode":null,"errorMessage":"${MANAGED_CONFIG_ENV_KEY} ${detail}","messagePattern":"\\$\\{MANAGED_CONFIG_ENV_KEY\\} \\$\\{detail\\}","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/src/services/managed-config.ts","lineNumber":122,"sourceCode":"\n/**\n * The set of feature keys a managed-config document may target: the boolean\n * flag keys of `instanceExperimentalSettingsSchema`. The schema is the\n * manifest — server-managed bookkeeping fields (activation cutoffs, lookback\n * hours) are not booleans and are excluded by construction.\n */\nexport function managedFeatureKeySet(): ReadonlySet<string> {\n  if (!cachedFeatureKeys) {\n    const defaults = instanceExperimentalSettingsSchema.parse({}) as Record<string, unknown>;\n    cachedFeatureKeys = new Set(\n      Object.keys(defaults).filter((key) => typeof defaults[key] === \"boolean\"),\n    );\n  }\n  return cachedFeatureKeys;\n}\n\nfunction fail(detail: string): never {\n  throw new Error(`${MANAGED_CONFIG_ENV_KEY} ${detail}`);\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n  return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction describeJsonValue(value: unknown): string {\n  if (value === null) return \"null\";\n  if (Array.isArray(value)) return \"an array\";\n  return `${JSON.stringify(value)}`;\n}\n\n/**\n * Parse `PAPERCLIP_MANAGED_CONFIG` from a raw env map. Returns null only when\n * the variable is absent (self-hosted). Throws with a precise error on a\n * present-but-blank value or any malformed document so a cloud instance fails\n * to start (fail closed).\n */","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/server/src/services/managed-config.ts#L104-L140","documentation":"fail() sentinel used by parseManagedConfigEnv: the PAPERCLIP_MANAGED_CONFIG env document violated a parsing rule (bad JSON, unknown feature key, bad shape), and `detail` describes the specific violation. Centralizes all managed-config startup errors under one env-key-prefixed message.","triggerScenarios":"Thrown at server/src/services/managed-config.ts:122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the managed config issue described in the detail, then restart."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}