data(예: retryable, reason, capability)를 가진 JSON-RPC 오류이며, 연결은 WebSocket 종료 코드로 끝납니다. 각 SDK는 이를 타입이 지정된 오류로 제공합니다.
bma-executor-sdk 1.12.2과 그 계약(
contracts/bma/executor, 프로토콜 bma.executor.v1.1)에서 생성했습니다. 설치, 자격 증명, 빠른 시작은 bma-executor-sdk 개요를, 프로토콜 자체는 Executor Protocol을 참고하세요.RPC 오류
상대가 반환한 JSON-RPC 오류, 또는 특정 코드와 data로 응답하려고 핸들러가 반환하는 오류.export class RpcError extends Error {
constructor(
static withReason(code: number, reason: string, message: string): RpcError
toJSON(): JsonRpcError
}
class RPCError(ExecutorError):
"""A JSON-RPC error. A handler that raises it keeps its code on the wire."""
def __init__(self, code: int, message: str, data: dict[str, Any] | None = None) -> None: ...
@classmethod
def with_reason(cls, code: int, reason: str, message: str) -> RPCError: ...
@property
def retryable(self) -> bool | None: ...
def to_wire(self) -> dict[str, Any]: ...
type RPCError struct {
Code int
Message string
Data *JSONRPCErrorData
}
클라이언트 오류
executor 쪽: 연결 안 됨, 중지됨, 같은 ID의 다른 executor로 교체됨(종료 코드 4004: 멈추고 재연결하지 마세요), 재연결 소진.export class NotConnectedError extends Error {
constructor(message = 'executor channel is not connected')
}
export class ClientStoppedError extends Error {
constructor()
}
export class RequestTimeoutError extends Error {
constructor(method: string)
}
class NotConnectedError(ExecutorError):
"""The channel is not connected (yet, or any more)."""
def __init__(self, message: str = "executor channel is not connected") -> None: ...
class ClientStoppedError(ExecutorError):
"""The client was stopped, or closed with a terminal close code."""
def __init__(self, message: str = "client stopped") -> None: ...
var (
// ErrNotConnected is returned when a call is attempted before the channel opens.
ErrNotConnected = errors.New("bmaexecutor: executor channel is not connected")
// ErrClientStopped is returned after Stop or a terminal close code.
ErrClientStopped = errors.New("bmaexecutor: client stopped")
// ErrReplaced is Err after the harness closed with 4004: a newer
// connection for this executor is authoritative and this one must stop.
ErrReplaced = errors.New("bmaexecutor: executor connection was replaced (4004)")
// errResumedFromSuspend ends a connection the host was suspended with.
errResumedFromSuspend = errors.New("bmaexecutor: host resumed from suspend")
// ErrReconnectExhausted is Err after a positive MaxReconnectAttempts
// failed; it wraps the last failure.
ErrReconnectExhausted = errors.New("bmaexecutor: executor reconnect attempts exhausted")
// ErrCredentialRejected is wrapped by the token request error when the
// token endpoint answers 401 or 403 (an invalid or revoked environment
// key or machine token). A reconnect does not retry it: the client ends
// with it as Err. A TokenSource may wrap it for the same effect.
ErrCredentialRejected = errors.New("bmaexecutor: executor credential rejected")
// ErrRegistrationRefused is Err after the platform refused the
// executor's registration maxRefusedRegistrations times in a row: the
// close 4002 "runtime registration refused" right after
// executor.register, or an executor.register error for the executor's
// capabilities. It is a configuration error (a machine-scoped executor
// must declare the process or agent capability) that reconnecting
// cannot fix. It wraps the last refusal.
ErrRegistrationRefused = errors.New("bmaexecutor: executor registration refused")
)
harness 오류
harness 쪽: 세션이 끝남,tool.result 전에 executor를 잃음(도구 결과를 알 수 없음), 또는 executor가 session.assign을 거부함.
export class SessionEndedError extends Error {
constructor()
}
export class ToolOutcomeUnknownError extends Error {
constructor()
}
export class AssignRejectedError extends Error {
constructor()
}
class SessionEndedError(ExecutorError):
"""A request on a session that has ended."""
def __init__(self) -> None: ...
class ToolOutcomeUnknownError(ExecutorError):
"""The executor was lost (lease expiry, executor.close, session ended, or a"""
def __init__(self) -> None: ...
class AssignRejectedError(ExecutorError):
"""session.assign answered accepted=false."""
def __init__(self) -> None: ...
var (
// ErrSessionEnded is returned for requests on a session that has ended.
ErrSessionEnded = errors.New("bmaexecutor: session ended")
// ErrToolOutcomeUnknown means the executor was lost (lease expiry,
// executor.close, session ended, or a restarted executor that no longer
// reports the session) before a tool.result arrived. The tool may or may
// not have run; the caller decides whether a retry is safe.
ErrToolOutcomeUnknown = errors.New("bmaexecutor: tool outcome unknown: executor lost before tool.result")
// ErrAssignRejected is returned when session.assign answers accepted=false.
ErrAssignRejected = errors.New("bmaexecutor: executor rejected session.assign")
)
종료 코드
클라이언트를 완전히 멈추게 하는 종료 코드.export function isTerminalCloseCode(code: number): boolean
# Python SDK 1.12.2에는 없습니다.
func CloseCode(err error) int
JSON-RPC 오류 코드
| 코드 | 메시지 |
|---|---|
-32700 | parse_error |
-32600 | invalid_request |
-32601 | method_not_found |
-32602 | invalid_params |
-32603 | internal_error |
-32000 | unauthorized |
-32001 | forbidden |
-32002 | not_found |
-32003 | lease_expired |
-32004 | timeout |
-32005 | canceled |
-32006 | payload_too_large |
-32007 | session_not_active |
-32008 | mcp_unavailable |
-32009 | executor_busy |
-32010 | unsupported_protocol |
-32011 | resource_unavailable |
-32012 | capability_unavailable |
-32013 | conflict |
오류 data
| 이름 | 타입 | 필수 | 설명 |
|---|---|---|---|
retryable | boolean | 아니요 | 호출자가 백오프로 재시도해야 하는 용량 또는 시간 초과 실패. |
detail | string | 아니요 | |
capability | string | 아니요 | -32012에서 빠진 기능(예: “tool:read”, “process.pty”). |
reason | string | 아니요 | 기계가 읽을 수 있는 원인. harness가 그대로 전달하는 열린 집합입니다(process.start: 도구 결과의 error_code와 프로세스 상태의 reason, turn.start: session.error의 code). 권장 값: workspace_unavailable, workspace_boundary, workspace_read_only, session_rejected, local_confirmation_denied, local_confirmation_expired, process.start의 spawn_failed / process_id_spec_mismatch, executor.register의 capability_missing, model_token.refresh의 turn_inactive / forbidden / model_token_unavailable, tools_token.refresh의 turn_inactive / forbidden / tools_token_unavailable(계약 1.4.0). 플랫폼 도구 호출(플랫폼 도구 엔드포인트, AsyncAPI x-bma-platform-tools의 ToolErrorCode)의 도구 결과 error_code도 열린 집합이며 environment_unavailable, machine_starting, machine_rebuilding, permission_denied, approval_required, approval_invalid, in_progress, idempotency_key_reused도 포함합니다(계약 1.4.0). computer use 호출에는 desktop_busy(다른 세션의 턴이 머신의 데스크톱을 점유 중)와 desktop_human_control(사람이 데스크톱의 제어 리스를 보유 중: computer_observe와 computer_action이 모두 거부되고, 아무것도 실행되지 않으며 스크린샷도 찍지 않습니다. 제어를 돌려받은 뒤 호출자는 행동하기 전에 다시 관찰합니다)도 포함됩니다. 수신자는 모르는 값도 받아들여야 합니다. |
terminal_code | string | 아니요 | terminal.* 호출이 실패했을 때의 bma.terminal.v1 오류 코드. |
expected_sequence | integer | 아니요 | 에이전트 session.event 누락(-32013): harness가 다음으로 기대하는 시퀀스. |
종료 코드
| 코드 | 의미 |
|---|---|
4001 | 토큰 만료 |
4003 | 지원되지 않는 프로토콜 |
4004 | 교체됨 |
4005 | drain 완료 |