paperclipai/paperclip · error
Unexpected ${fieldName} value: ${value}
Error message
Unexpected ${fieldName} value: ${value} What it means
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.
Source
Thrown at server/src/services/environments.ts:134
export interface ManagedSandboxEnvironmentReconcileResult {
environment: Environment;
action: ManagedSandboxEnvironmentReconcileAction;
/** Classification observed before this reconciliation wrote anything. */
stockStatus: ManagedResourceStockStatus;
/** True only when operator drift prevented the available stock update. */
updateAvailable: boolean;
stockHash: string;
}
function cloneRecord(value: unknown, fallback: Record<string, unknown> | null = null): Record<string, unknown> | null {
if (!value || typeof value !== "object" || Array.isArray(value)) return fallback;
return { ...(value as Record<string, unknown>) };
}
function readEnum<T extends string>(value: string | null, allowed: readonly T[], fieldName: string): T | null {
if (value === null) return null;
if ((allowed as readonly string[]).includes(value)) return value as T;
throw new Error(`Unexpected ${fieldName} value: ${value}`);
}
function hasConstraintName(error: unknown, constraintName: string): boolean {
if (typeof error !== "object" || error === null) return false;
const candidate = error as {
constraint?: unknown;
constraint_name?: unknown;
cause?: unknown;
};
return candidate.constraint === constraintName
|| candidate.constraint_name === constraintName
|| hasConstraintName(candidate.cause, constraintName);
}
function toEnvironment(row: EnvironmentRow): Environment {
return {
id: row.id,
name: row.name,View on GitHub (pinned to 01ad858492)
Solutions
- Provide a valid value for the named field; check the allowed enum values for environment configuration.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/src/services/environments.ts:134 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-08-18).
Data as JSON: /api/errors/90fec9e1197fb7b2.
Report an issue: GitHub.