{"record":{"id":"246100a23df93644","repo":"paperclipai/paperclip","slug":"path-must-be-an-object","errorCode":null,"errorMessage":"${path} must be an object","messagePattern":"(.+?) must be an object","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/paperclip-runner/src/cli/eval-session-contract.ts","lineNumber":96,"sourceCode":"  session: CreateCapabilityLiveSessionInput;\n  nativeResume?: { operationId: string };\n  /** Current live sessions always use Codex collaboration instructions. */\n  includeCollaborationModeInstructions?: true;\n}\n\nexport interface EvalSessionUsage extends EstimatedModelCost {\n  agentTurns: number;\n  providerRequests: number;\n  inputTokens: number;\n  outputTokens: number;\n  cachedInputTokens: number;\n  reasoningTokens: number;\n  providerReportedCostNanodollars: number;\n}\n\nfunction object(value: unknown, path: string): Record<string, unknown> {\n  if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n    throw new Error(`${path} must be an object`);\n  }\n  return value as Record<string, unknown>;\n}\n\nfunction text(value: unknown, path: string): string {\n  if (typeof value !== \"string\" || value.trim().length === 0) {\n    throw new Error(`${path} must be a non-empty string`);\n  }\n  return value;\n}\n\nfunction positiveInteger(value: unknown, path: string): number {\n  if (!Number.isSafeInteger(value) || Number(value) <= 0) {\n    throw new Error(`${path} must be a positive safe integer`);\n  }\n  return Number(value);\n}\n","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/paperclip-runner/src/cli/eval-session-contract.ts#L78-L114","documentation":"The object() helper in eval-session-contract.ts is the fail-closed validator for the eval-session executable boundary. It requires a decoded JSON value at a given path to be a plain object — not a string, number, boolean, null, or array. If it is not, it throws '<path> must be an object' with the exact request path in the message.","triggerScenarios":"Passing a value that is not a plain object at any path validated with object(), e.g. request itself, request.managedProfile, request.agentCoreProfile, or a nested field, when it is null, an array, or a primitive.","commonSituations":"The eval-session request was serialized as a JSON array or string; a caller posted null; double-parsing turned the object into a string; a schema change made a nested profile field optional so it arrives undefined/null.","solutions":["Ensure the value passed to parseEvalSessionRequest is a decoded JSON object (not a JSON string — call JSON.parse first if needed)","Check the path in the error message to find which field is not an object and fix the producer to send an object there","Remove null/array values at that path before validation","Align the caller's request payload with the current eval-session request schema"],"exampleFix":"// before\nparseEvalSessionRequest(JSON.stringify(req));\n// after\nparseEvalSessionRequest(typeof req === 'string' ? JSON.parse(req) : req);","handlingStrategy":"type-guard","validationCode":"function isPlainObject(v) {\n  return typeof v === 'object' && v !== null && !Array.isArray(v);\n}\nif (!isPlainObject(rawRequest)) throw new Error('request payload must be a decoded JSON object');","typeGuard":"const isRecord = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);\nfunction asRecord(v) { return isRecord(v) ? v : null; }","tryCatchPattern":"try {\n  const request = parseEvalSessionRequest(raw);\n} catch (err) {\n  if (err.message.endsWith('must be an object')) {\n    console.error('Malformed eval-session request at', err.message.split(' ')[0]);\n  }\n  throw err;\n}","preventionTips":["Always JSON.parse string payloads before calling parseEvalSessionRequest","Never send null or arrays where an object is required","Keep request construction in one typed factory so shapes cannot drift","Log the failing path from the error message to pinpoint the malformed field"],"tags":["validation","contract","type-error"],"backgroundTag":"schema-validation-failed","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-02T18:44:00.616Z","contentChangedAt":"2026-09-02T18:44:00.616Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}