DK Studio/Documentation
ProductChangelog

Error Codes

Every error the platform can return, organised by the area that raises it: an agent command, an HTTP endpoint, or a socket. Each area has its own vocabulary, and the catalogue below holds all three.

Agent command errors

These appear as error.code in the error of a command response, and in the stored result of a failed command.

CodeRaised byMeaning
UNKNOWN_COMMANDAny unrecognised command nameThe agent does not know the command. The message is Unknown command: <name>.
MISSING_SCRIPTshellNo script argument was supplied.
MISSING_PATHopen_serial, close_serialNo path argument was supplied.
MISSING_ARGSserial_writepath or data was missing.
NOT_IMPLEMENTEDrun_test_suite, upload_artifactThe command is part of the contract but the agent does not implement it.
EXECUTION_ERRORAny commandThe handler threw. The message is the exception text.
COMMAND_TIMEOUTAny commandThe command exceeded its timeout.

The same set is produced by both delivery paths β€” the socket and the polling fallback β€” because both call the same handlers.

Two failures are reported through the output rather than through the result's status.

FailureResult
The command exceeded its timeoutstatus is timeout, output.exitCode is -2, and output.stderr reads Command timed out after <ms>ms. The code COMMAND_TIMEOUT names the same condition.
The process could not be spawnedstatus is error, error.code is EXECUTION_ERROR, and output.exitCode is -1.

Result statuses

The status field of a command result takes one of three values.

StatusMeaning
successThe command ran and did what it was asked to do. shell also uses it for exit code 0.
errorThe command failed. error.code says why. A shell script that exits non-zero is reported as error with the script's own exit code in output.exitCode.
timeoutThe command exceeded its timeout and was stopped. output.exitCode is -2 and output.stderr reads Command timed out after <ms>ms.

The command row itself moves pending β†’ in_progress β†’ completed. A failed command is still completed: the result, including the error, is stored.

HTTP status codes

What the studio's REST endpoints return.

StatusBodyWhere
400Missing agentId or commandPOST /api/agents/command β€” a required field is absent.
400Agent is offlinePOST /api/agents/command β€” no live socket for that agent.
400Agent is not activePOST /api/agents/command β€” the stored status is not active.
401Invalid API keyPOST /api/agent/auth β€” the key matches no agent.
403invalid_codePOST /api/agent/register β€” the code matches no licence.
403usedPOST /api/agent/register β€” the licence was already spent on another machine.
403revokedPOST /api/agent/register β€” the licence was revoked.
403expiredPOST /api/agent/register β€” the licence has passed its expiry.
403invalid_credentialsPOST /api/agent/register β€” the agentId and agentSecret pair matches no agent.
403License has been expiredPOST /api/agent/register β€” the licence has passed its expiry.
404Agent not foundPOST /api/agents/command β€” no agent with that id.
404Agent or license not foundDELETE /api/admin/agents/{id} β€” the id matches neither an agent nor a licence.
500Database not configuredAny endpoint that needs the database, before setup has run.

Errors are returned as {"error": "…"} on most routes. POST /api/agent/register uses {"success": false, "error": "…"}.

Socket errors

A socket response that reports a failure carries ok: false and an error object with a code from the protocol's error vocabulary.

CodeRaised byMeaning
AUTH_FAILEDThe auth and dashboard_auth handshakesThe agent's id and secret did not match, or the dashboard's token did not. The socket is closed.
PROTOCOL_VERSION_UNSUPPORTEDThe auth handshakeThe agent speaks a protocol version the studio does not. The socket is closed.

A command that fails on the socket reports its code the same way β€” in the error of a command response whose ok is false.

Triage

SymptomStart here
Agent is offlineThe agent's socket is not connected. Check the agent log and the network path. See Agent Offline.
Agent is not activeThe agent unregistered, or its licence was revoked and the row changed. Re-register it.
Invalid API keyThe key in data/agent.json no longer matches the studio's agents.api_key. Register again to get a fresh pair.
403 on registrationThe licence is invalid, revoked or expired. Issue a new one from the admin screen.
AUTH_FAILED on an agentThe agent's agentSecret does not match agents.agent_secret. Re-register the agent to reissue both credentials.
AUTH_FAILED on a dashboardThe token the dashboard presented does not match DASHBOARD_WS_TOKEN. See Configuration.
PROTOCOL_VERSION_UNSUPPORTEDThe agent speaks a protocol version the studio does not. Upgrade the agent and reconnect. See Version Compatibility.
UNKNOWN_COMMANDThe command name is wrong, or it belongs to a newer studio than the agent. See Version Compatibility.
MISSING_SCRIPT, MISSING_PATH, MISSING_ARGSThe command was sent without a required argument. See Command Reference.
EXECUTION_ERRORRead error.message: it carries the text of the exception the handler raised.
NOT_IMPLEMENTEDThe agent does not implement that command. Upgrade the agent, or do not dispatch it.
timeoutThe command ran past its timeout. Raise the timeout, or make the script faster.

See also