Skip to content

Errors

This page is the API reference for PhdError and its subclasses: the exceptions PHD raises before a harness is launched. Causes and fixes: Troubleshooting.

Anything that goes wrong after launch is reported in RunResult (status, error.kind) and never raised.

Summary

All classes are importable from phd and subclass PhdError (which subclasses Exception). Only ModelNotSupported carries extra attributes.

Exception Raised when
PhdError base class; catch it to handle every pre-launch problem
UnknownHarness harness name is not claude, codex or opencode
HarnessNotInstalled the CLI is not on PATH at launch or for the catalogue
CwdNotFound Spec.cwd is not a directory
InputNotFound Inputs.brief / Inputs.rules is not a file
EmptyTask no brief and no non-blank msg
StackInvalid malformed stack directory
StackFetchError a stack source cannot be read or downloaded, or its archive is unusable or unsafe
StackConflict the store has this name@version with different content (pass replace=True)
StackNotFound no stored stack matches the reference, or a stack's folder no longer exists
StackIncompatible stack's harnesses excludes Spec.harness
HookUnsupported non-neutral hook event, or event/tool not expressible for the harness
MissingSecret ${env:NAME} without Spec.secrets["NAME"]
MissingCredentials credentials missing, unreadable, for another harness, or of an unusable kind
UnsafeAutonomy autonomy="full" without unsafe=True
UnsupportedFeature Spec(chrome=True) with codex or opencode; Inputs.rules on a resumed turn (rules are part of the session's system prompt); an output_schema keyword codex cannot express (patternProperties, if, not, ...), raised by Dispatcher(spec)
InvalidSpec invalid Spec field value, including a malformed output_schema and a bad idle_timeout_s / schema_repair
InvalidRunsRoot codex runs_root under the system temp dir
NotResumable a session_id cannot be continued right now (session busy, tampered home or missing run.json, or plan() with an unresumable session); other unresumable sessions come back as error.kind == "session" results
ModelNotSupported(harness, model, supported, hint=None) model not in the catalogue; attributes harness, model, supported, hint
from phd import Dispatcher, ModelNotSupported, PhdError

try:
    d = Dispatcher(spec)
except ModelNotSupported as e:
    print(e.hint, e.supported[:5])
except PhdError as e:
    print("cannot start:", e)

Full reference

Rendered from the docstrings (MkDocs site only).

PhdError

Bases: Exception

Base class for every error PHD raises before launching a harness.

Catch PhdError to handle every pre-launch problem; the message names the offending file, field or value.

UnknownHarness

Bases: PhdError

The harness name is not claude, codex or opencode.

HarnessNotInstalled

Bases: PhdError

The harness CLI was not found on PATH at launch (or by ModelCatalog).

CwdNotFound

Bases: PhdError

Spec.cwd is not an existing directory.

InputNotFound

Bases: PhdError

Inputs.brief or Inputs.rules is not an existing file.

EmptyTask

Bases: PhdError

Inputs has neither a brief nor a non-blank msg.

StackInvalid

Bases: PhdError

The stack directory is malformed (stack.json, agents/, skills/, .mcp.json, hooks.json).

StackFetchError

Bases: PhdError

A stack source could not be read or downloaded, or its archive is unusable or unsafe.

StackConflict

Bases: PhdError

The store already has this name@version with different content (pass replace=True to overwrite).

StackNotFound

Bases: PhdError

No stored stack matches the reference, or a stack's directory no longer exists.

StackIncompatible

Bases: PhdError

The stack's harnesses list does not include Spec.harness.

HookUnsupported

Bases: PhdError

A hook's event is not neutral, or its event/tool cannot be expressed for the harness.

MissingSecret

Bases: PhdError

The stack references ${env:NAME} but Spec.secrets has no NAME.

MissingCredentials

Bases: PhdError

Credentials are missing, unreadable, for another harness, or of a kind the harness cannot use.

UnsafeAutonomy

Bases: PhdError

autonomy="full" was requested without unsafe=True.

UnsupportedFeature

Bases: PhdError

A feature is not supported here, for example Inputs.rules on a resumed turn.

InvalidSpec

Bases: PhdError

A Spec field has an invalid value (model, modes, harness_builtins, timeout_s, budget_usd).

InvalidRunsRoot

Bases: PhdError

codex with a runs_root under the system temp dir (codex refuses a temp CODEX_HOME).

NotResumable

Bases: PhdError

A session_id cannot be continued: no run has it, other harness, run home gone, or other cwd.

ModelNotSupported

ModelNotSupported(harness: str, model: str, supported: list[str], hint: str | None = None)

Bases: PhdError

Spec.model is not in the harness's model catalogue.

Attributes:

Name Type Description
harness

The harness name.

model

The rejected model.

supported

The catalogue the model was checked against.

hint

The closest catalogue entry, if any.


Next: Design record ยท See also: API overview, Troubleshooting