🤖 New in SPACE GASS 14.51 — the MCP server lets your AI agent build, analyse and design your models. Get started →
SpaceGass API
Guides

Error Handling

Every error response from the API uses a standard ErrorResponse envelope. All error responses include a JSON body with diagnostic information.

Error Response Format

JSONCode
{ "title": "Bad Request", "status": 400, "detail": "Node with Id 1 already exists", "errorCode": "DUPLICATE_ENTITY", "errors": [ { "field": "id", "message": "Node with Id 1 already exists", "code": "DUPLICATE_ENTITY" } ], "source": "Application", "timestamp": "2026-05-18T10:30:00+10:00" }
FieldTypeDescription
titlestringShort human-readable summary
statusintHTTP status code
detailstringHuman-readable explanation specific to this occurrence
errorCodestringMachine-readable error code for programmatic handling
errorsValidationError[]One entry per failed validation rule (field, message, code)
sourcestringWhere the error originated (e.g. "Application", "Infrastructure")
timestampstringISO 8601 timestamp when the error occurred
instancestringURI reference for the specific occurrence
extensionsobjectAdditional context-specific data

HTTP Status Codes

StatusMeaning
400Bad request — validation failure or invalid input
404Not found — resource does not exist
409Conflict — operation conflicts with current state (e.g., file locked)
500Server error — unexpected internal failure

Handling Errors in SDK Clients

The SDK raises a typed ErrorResponse exception that carries the fields from the JSON body — Status, Title, Detail, ErrorCode, Errors, and more. Catch it directly so you can inspect the structured error rather than relying on the generic exception message:

using SpaceGassApi.Models; try { var node = await client.Job.Structure.Nodes[999].GetAsync(); } catch (ErrorResponse err) when (err.Status == 404) { Console.WriteLine($"Node not found: {err.Detail}"); } catch (ErrorResponse err) { Console.WriteLine($"API error {err.Status} ({err.Title}): {err.Detail}"); if (err.ErrorCode != null) Console.WriteLine($" Code: {err.ErrorCode}"); foreach (var ve in err.Errors ?? []) Console.WriteLine($" [{ve.Field}] {ve.Message}"); }

ErrorResponse inherits from Kiota's base ApiException (C#) / APIError (Python), so you can still catch the broader type if you need to handle transport errors (network drops, timeouts) the same way.

Last modified on