{"record":{"id":"90fec9e1197fb7b2","repo":"paperclipai/paperclip","slug":"unexpected-fieldname-value-value","errorCode":null,"errorMessage":"Unexpected ${fieldName} value: ${value}","messagePattern":"Unexpected (.+?) value: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/src/services/environments.ts","lineNumber":134,"sourceCode":"export interface ManagedSandboxEnvironmentReconcileResult {\n  environment: Environment;\n  action: ManagedSandboxEnvironmentReconcileAction;\n  /** Classification observed before this reconciliation wrote anything. */\n  stockStatus: ManagedResourceStockStatus;\n  /** True only when operator drift prevented the available stock update. */\n  updateAvailable: boolean;\n  stockHash: string;\n}\n\nfunction cloneRecord(value: unknown, fallback: Record<string, unknown> | null = null): Record<string, unknown> | null {\n  if (!value || typeof value !== \"object\" || Array.isArray(value)) return fallback;\n  return { ...(value as Record<string, unknown>) };\n}\n\nfunction readEnum<T extends string>(value: string | null, allowed: readonly T[], fieldName: string): T | null {\n  if (value === null) return null;\n  if ((allowed as readonly string[]).includes(value)) return value as T;\n  throw new Error(`Unexpected ${fieldName} value: ${value}`);\n}\n\nfunction hasConstraintName(error: unknown, constraintName: string): boolean {\n  if (typeof error !== \"object\" || error === null) return false;\n  const candidate = error as {\n    constraint?: unknown;\n    constraint_name?: unknown;\n    cause?: unknown;\n  };\n  return candidate.constraint === constraintName\n    || candidate.constraint_name === constraintName\n    || hasConstraintName(candidate.cause, constraintName);\n}\n\nfunction toEnvironment(row: EnvironmentRow): Environment {\n  return {\n    id: row.id,\n    name: row.name,","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/environments.ts#L116-L152","documentation":"readEnum sentinel in environments.ts row mappers (toEnvironment/toEnvironmentLease): a database column expected to hold a known enum value (status, driver, etc., named by fieldName) contained something unexpected. The offending value is included; the row cannot be mapped to a typed Environment object.","triggerScenarios":"Thrown at server/src/services/environments.ts:134 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a valid value for the named field; check the allowed enum values for environment configuration."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}