{"record":{"id":"cee27941bf8ccdef","repo":"coleam00/Archon","slug":"pi-provider-requires-a-model-set-model-on-the-w","errorCode":null,"errorMessage":"Pi provider requires a model. Set `model` on the workflow node or `assistants.pi.model` in .archon/config.yaml, or select a default model in the `pi` CLI (writes defaultProvider/defaultModel to ~/.pi/agent/settings.json). Format: '<pi-provider-id>/<model-id>' (e.g. 'google/gemini-2.5-pro').","messagePattern":"Pi provider requires a model\\. Set `model` on the workflow node or `assistants\\.pi\\.model` in \\.archon/config\\.yaml, or select a default model in the `pi` CLI \\(writes defaultProvider/defaultModel to ~/\\.pi/agent/settings\\.json\\)\\. Format: '<pi-provider-id>/<model-id>' \\(e\\.g\\. 'google/gemini-2\\.5-pro'\\)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/providers/src/community/pi/provider.ts","lineNumber":398,"sourceCode":"        // that would otherwise surface them).\n        for (const { scope, error: settingsErr } of settingsManager.drainErrors()) {\n          getLog().warn({ scope, err: settingsErr }, 'pi.settings_default_model_read_error');\n        }\n        const provider = settings.defaultProvider?.trim();\n        const modelId = settings.defaultModel?.trim();\n        if (provider && modelId) {\n          modelRef = `${provider}/${modelId}`;\n          getLog().info({ modelRef }, 'pi.model_defaulted_from_settings');\n        }\n      } catch (err) {\n        // Non-fatal: settings.json may be absent (user never ran `pi`) or\n        // unreadable. Fall through to the explicit \"requires a model\" error\n        // below rather than swallowing the missing-model condition.\n        getLog().debug({ err }, 'pi.settings_default_model_read_failed');\n      }\n    }\n    if (!modelRef) {\n      throw new Error(\n        'Pi provider requires a model. Set `model` on the workflow node or `assistants.pi.model` in .archon/config.yaml, ' +\n          'or select a default model in the `pi` CLI (writes defaultProvider/defaultModel to ~/.pi/agent/settings.json). ' +\n          \"Format: '<pi-provider-id>/<model-id>' (e.g. 'google/gemini-2.5-pro').\"\n      );\n    }\n    const parsed = parsePiModelRef(modelRef);\n    if (!parsed) {\n      throw new Error(\n        `Invalid Pi model ref: '${modelRef}'. Expected format '<pi-provider-id>/<model-id>' (e.g. 'google/gemini-2.5-pro').`\n      );\n    }\n\n    // 2. Build ModelRuntime + ModelRegistry. Both read on every sendQuery —\n    //    user edits to auth.json or models.json take effect without restart.\n    //    The registry is a thin facade over the runtime — extension providers\n    //    call registerProvider() on it during bindExtensions() to add their\n    //    models (phase 2 resolution).\n    const envVarName = PI_PROVIDER_ENV_VARS[parsed.provider];","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/providers/src/community/pi/provider.ts#L380-L416","documentation":"sendQuery needs a model reference ('<pi-provider-id>/<model-id>') to build the Pi session. It resolves the ref from the workflow node's `model`, the config's `assistants.pi.model`, and finally the pi CLI's default settings (~/.pi/agent/settings.json); if none yields a ref, it throws with instructions for all three sources.","triggerScenarios":"Calling sendQuery when the node has no `model`, .archon/config.yaml has no assistants.pi.model, and ~/.pi/agent/settings.json lacks defaultModel (or its read failed, which is logged and intentionally falls through to this error).","commonSituations":"Fresh installs where `pi` was never launched and /login never run, CI containers without a home-dir Pi settings file, or config where the model key was renamed/omitted.","solutions":["Set `model: 'google/gemini-2.5-pro'` (or another ref) on the workflow AI node","Set assistants.pi.model in .archon/config.yaml","Run `pi` locally, select a default model (writes defaultProvider/defaultModel to ~/.pi/agent/settings.json)","If a default was set, verify ~/.pi/agent/settings.json is readable and contains defaultModel"],"exampleFix":"// before (.archon/config.yaml)\nassistants:\n  pi: {}\n// after\nassistants:\n  pi:\n    model: 'google/gemini-2.5-pro'","handlingStrategy":"validation","validationCode":"function resolvePiModelRef(node, config, home = process.env.HOME) {\n  if (node.model) return node.model;\n  if (config?.assistants?.pi?.model) return config.assistants.pi.model;\n  try {\n    const s = JSON.parse(readFileSync(join(home, '.pi/agent/settings.json'), 'utf8'));\n    if (s.defaultProvider && s.defaultModel) return `${s.defaultProvider}/${s.defaultModel}`;\n  } catch { /* fall through */ }\n  return null;\n}\nif (!resolvePiModelRef(node, config)) throw new Error('No Pi model configured');","typeGuard":"function hasModelRef(x: unknown): x is { model: string } {\n  return typeof x === 'object' && x !== null && typeof (x as any).model === 'string' && (x as any).model.length > 0;\n}","tryCatchPattern":"try {\n  await sendQuery(q);\n} catch (err) {\n  if (err.message.includes('Pi provider requires a model')) {\n    console.error('Set model on the node or assistants.pi.model in .archon/config.yaml, or run `pi` and pick a default');\n  }\n  throw err;\n}","preventionTips":["Set a default assistants.pi.model in .archon/config.yaml for every deployment","Run `pi` once and select a default model when provisioning a machine","Verify settings.json exists and is readable in container images"],"tags":["configuration","model","pi"],"backgroundTag":"missing-model-configuration","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}