Skip to content

Errors and execution results ​

An implementation MUST distinguish protocol failure from business execution failure. Collapsing both into one “failed” state causes duplicate writes, false success, or treating a permission denial as a transient error.

Two result classes ​

ClassFieldsMeaning
Protocol failureok: false, top-level errorThe request did not enter business execution, or the execution boundary raised an internal exception
Business resultok: true, resultThe call reached the executor; the executor defines success or structured failure

A business failure appears in result.error:

json
{
  "protocol": "pling.surface/0.1",
  "id": "req_02",
  "ok": true,
  "result": {
    "error": {
      "code": "EXPECTATION_FAILED",
      "message": "No new state was observed after saving"
    }
  }
}

A client MUST check ok, then result.error. Checking only HTTP status or only ok is insufficient.

Protocol errors ​

CodeTriggerExecuted?
INVALID_REQUESTInvalid envelope, field, type, or valueNo
PROTOCOL_VERSION_UNSUPPORTEDprotocol is not supportedNo
METHOD_NOT_SUPPORTEDMethod is not describe or invokeNo
CAPABILITY_NOT_EXPOSEDCapability is outside site/session intersectionNo
SESSION_REQUIREDImplementation requires a session and none existsNo
SESSION_INVALIDSession is malformed or unboundNo
SESSION_EXPIREDSession passed its expiryNo
SESSION_REVOKEDSession was revokedNo
RATE_LIMITEDWindow exceeded; may include retryAfterMsNo
RATE_LIMIT_UNAVAILABLELimiter failed and the implementation failed closedNo
REPLAY_DETECTEDA consumed request.id was reused in the sessionNo
REPLAY_GUARD_UNAVAILABLEReplay guard failed and the implementation failed closedNo
INTERNAL_ERRORInternal implementation exception; no inference of business successUnconfirmed

INTERNAL_ERROR can occur near the execution boundary. A client MUST NOT automatically resend a write after receiving it. It should observe business state through a read path or ask a person to verify.

Business errors ​

An executor may return these stable codes:

CodeMeaning
DUPLICATE_ACTION_IDDuplicate action id was declared
DUPLICATE_STATE_KEYDuplicate state key was declared
DUPLICATE_GUIDE_TARGETDuplicate guide target was declared
ACTION_NOT_FOUNDThe current page has no such action
INVALID_ARGSTool arguments are invalid JSON or malformed
INVALID_PARAMSArguments do not satisfy the schema
PERMISSION_DENIEDBusiness policy denied the action
ACTION_UNAVAILABLEPreconditions are not met
EXECUTION_FAILEDHandler threw or business logic rejected the action
EXPECTATION_FAILEDThe declared success condition was not observed
HANDOFF_CANCELLEDThe user cancelled handoff
HANDOFF_TIMEOUTHandoff timed out
HANDOFF_FAILEDThe user claimed completion but the result did not occur
STEP_FAILEDA composite step failed; may include resume
HOOK_BLOCKEDA lifecycle hook blocked execution
LOOP_DETECTEDThe runtime detected a loop

Business codes MUST remain machine-readable. message may be localized and MUST NOT be used as a branching contract.

Successful results ​

The executor and application define a successful result. It SHOULD include evidence sufficient to verify the business outcome, such as changed record ids, confirmed expectations, or an operation summary. It MUST NOT contain credentials, raw sensitive arguments, or internal object references.

Recovery rules ​

  • INVALID_REQUEST: fix the envelope; never retry unchanged.
  • CAPABILITY_NOT_EXPOSED: describe again; do not try a similar id.
  • ACTION_NOT_FOUND: the page or declaration changed; describe again.
  • ACTION_UNAVAILABLE: satisfy preconditions; do not bypass the gate.
  • INVALID_PARAMS: correct values against the schema.
  • PERMISSION_DENIED: stop and involve a person; the agent cannot self-authorize.
  • EXPECTATION_FAILED: observe the page first; a partial success may exist.
  • RATE_LIMITED: obey retryAfterMs.
  • REPLAY_DETECTED: do not mint a new id for the same intent; check the previous result first.
  • Session errors: reauthenticate or obtain a new delegation.

Logging and presentation ​

Logs may contain the error code, request id, capability id, and duration, but not full input or response bodies. User-facing text should explain an actionable next step without exposing a stack. Audit and alerting should key on error class and risk, not treat every business denial as an outage.