{"record":{"id":"68fb6776a8faeb6e","repo":"earendil-works/pi","slug":"select-a-harness-model-explicitly-or-set-both-pi-p","errorCode":null,"errorMessage":"Select a harness model explicitly or set both PI_PROVIDER and PI_MODEL as defaults.","messagePattern":"Select a harness model explicitly or set both PI_PROVIDER and PI_MODEL as defaults\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/evals/src/pi-harness.ts","lineNumber":53,"sourceCode":"type PiCodingAgentHarnessOptions = {\n\tname?: string;\n\tmodel?: PiCodingAgentModelSelection;\n\tnoTools?: CreateAgentSessionOptions[\"noTools\"];\n\ttransformSystemPrompt?: (defaultPrompt: string) => string;\n};\n\ntype PiCodingAgentHarnessWithOutput<TOutput extends JsonValue> = PiCodingAgentHarnessOptions & {\n\toutput: (args: { response: string; session: AgentSession }) => TOutput | Promise<TOutput>;\n};\n\nexport function resolveModelSelection(\n\texplicitModel: PiCodingAgentModelSelection | undefined,\n\tenvironment: { PI_PROVIDER?: string; PI_MODEL?: string } = process.env,\n): PiCodingAgentModelSelection {\n\tconst provider = (explicitModel?.provider ?? environment.PI_PROVIDER)?.trim();\n\tconst id = (explicitModel?.id ?? environment.PI_MODEL)?.trim();\n\tif (!provider || !id) {\n\t\tthrow new Error(\"Select a harness model explicitly or set both PI_PROVIDER and PI_MODEL as defaults.\");\n\t}\n\treturn { provider, id };\n}\n\nfunction toTranscriptEvents(messages: AgentSession[\"messages\"]): TranscriptEvent[] {\n\tconst events: TranscriptEvent[] = [];\n\tfor (const message of messages) {\n\t\tif (message.role === \"user\") {\n\t\t\tevents.push({ type: \"message\", role: \"user\", content: contentText(message.content) });\n\t\t} else if (message.role === \"assistant\") {\n\t\t\tconst text = contentText(message.content);\n\t\t\tif (text) events.push({ type: \"message\", role: \"assistant\", content: text });\n\t\t\tfor (const part of message.content) {\n\t\t\t\tif (part.type === \"toolCall\") {\n\t\t\t\t\tevents.push({\n\t\t\t\t\t\ttype: \"tool_call\",\n\t\t\t\t\t\tid: part.id,\n\t\t\t\t\t\tname: part.name,","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/evals/src/pi-harness.ts#L35-L71","documentation":"Error \"Select a harness model explicitly or set both PI_PROVIDER and PI_MODEL as defaults.\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/evals/src/pi-harness.ts:53 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}