assemblyline.sh

Debug a run

Start from the work record: its status tells you where to look. A run that failed has its error on the work record and the whole story in the factory session's log. A run that never started is waiting for a session at its line's location.

This page is about runs. If the run completed but a workpiece landed in failed/, see Find out why a workpiece failed.

Find the run

al-orc work-records list --station IN1 --status failed
al-orc work-records show <id> --output --activity

--output shows the config the run was given and what the station returned, --activity the run's events, such as retries, and --report the report your station attached. --all shows everything.

StatusWhat happenedLook at
pendingNo factory session has claimed the run. After 30 minutes the run becomes timed_out.Is a session running at the line's location? al-orc factory-sessions list --location acme-office, al-control procs list
runningThe station is running now. After 4 hours the run becomes timed_out.The session log
failedThe station threw on its first try and on 3 retries, or the session had no handler for it. See Throw errors from a station.The error on the work record, then the session log
completedThe station finished. Workpieces may still have failed.al-control lines status IN -f . and Find out why a workpiece failed

All statuses are in the work record object reference.

Read the session log

The log is the session's output: the terminal you ran npm start in, or al-control procs logs -f . under pm2. Every line has one of these shapes:

LineComes from
--- wr:t7Qx9mPa2Lc start … done or failedOne try of one run, opened and closed. The id is the work record's.
[IN1] …Inside that station: its Config, then whatever your code prints
[Factory] …The session itself: start-up, files it wrote, attachments sent, poll errors, a station's error
[conveyor] …The conveyor: what it moved into each station's input, and any workpiece it couldn't move
[bin-watcher] …, [intake-watcher] …The watchers starting runs, and their warnings

One try of a run that failed, with the conveyor and another station running at the same time:

--- wr:t7Qx9mPa2Lc start
[IN2] Config: {"ledger_url":"https://ledger.example.com"}
[conveyor] IN1 from IN0/output: moved 3
[bin-watcher] triggered IN1 (work_record_id=K3vn8sWq0Rb)
--- wr:K3vn8sWq0Rb start
[IN1] Config: {"approval_limit":5000}
--- wr:K3vn8sWq0Rb done
[Factory] wr:t7Qx9mPa2Lc [IN2] error: ledger_env: missing LEDGER_API_KEY (see .env.example)
--- wr:t7Qx9mPa2Lc failed
  • Search by the work record id (grep wr:t7Qx9mPa2Lc) to pull one run out of the log. A run that is retried shows one block per try.
  • Blocks can interleave. The session runs different stations at the same time, so read each line's prefix to know which station printed it.
  • Config is exactly what your station received, before its schema filled in defaults. When a station behaves as if a setting is wrong, start there.

Usual causes

You seeCauseFix
The run stays pendingNo session is running at the line's location, or the session's FACTORY_LOCATION differs from the line's locationStart the session, or correct one of the two. See Run a factory session.
No handler for station and Unknown stationThe session didn't find that station's handlerCheck the folder and code in src/stations/, and restart the session. See How a session finds your stations.
Invalid configThe station's config doesn't match its configSchemaThe error lists each bad field. Compare it with the Config line, and see Write a station.
Missing required environment variablesThe session's .env lacks a settingSee Give stations their credentials
is served by another factory sessionA session already runs at this locationStop the other one, or give this one its own location
Poll failed: 401The API key or secret in .env is wrong or revokedCreate a new key in the Orchestrator's settings

Run the station on your machine

To try a fix without waiting for the next run, run the station with the config in its station file:

npx factory stations run IN2

It runs for real, the same code the session runs. See Run and test a station.