Errors
A call can fail because a definition is missing, a document is invalid, or the database refuses a change. The examples use the people data to show these results. Use the status and diagnostic fields to identify the failure.
Binding errors
| Language | Failure |
|---|---|
| C | Returns a status. The owner that its operation names holds the diagnostic. |
| Go | Returns *Error. |
| Rust | Returns Result<_, Error>. |
| Clojure | Throws clojure.lang.ExceptionInfo with diagnostic data. |
| Python | Raises StardustError. |
| Odin | Returns an Error beside its result. |
Schema-constrained mutations return code schema_validation and message Schema validation failed..
Their violations list identifies each entity, schema and failed keyword.
Each entry has entityPath and schemaPath arrays, such as [title] and [properties title minLength].
A token matching 0|[1-9][0-9]* within i64 is an integer, including when it names an object key.
Other tokens are strings.
The root is []; the empty-string key is [""]. Path arrays use decoded tokens, so / and ~ need no escaping.
Constraint and actual values retain their data types. Missing required members report missingProperty instead of an actual value.
Clojure uses kebab-case keys, such as :entity-path and :constraint-value.
The error record gives the fields in your language. Statuses gives the failure conditions of each operation.
error
This record describes a failure with its status and diagnostic. The binding copies the diagnostic before it releases the native owner.
| Field | Type | Unit | Absent | Meaning |
|---|---|---|---|---|
violations | Document | None | — | The binding copies schema violations before the failed owner closes. Each entry contains entity and schema identities, entityPath and schemaPath arrays, and a keyword. Canonical decimal tokens within i64 are integers, including object keys. Other tokens are strings. An empty array selects the root. Entries include applicable constraintValue, actualValue, actualLength or missingProperty data. The error code remains schema_validation. |
code | string | None | — | — |
message | string | None | — | — |
path | Maybe(string) | None | nil | — |
field | Maybe(string) | None | nil | — |
entity | Maybe(builtin.i64) | None | nil | — |
offset | Maybe(builtin.i64) | Bytes | nil | — |
status | Status | None | — | — |
Statuses
Each status names a class of failure. The table lists codes from the binding. Native diagnostic codes can differ.
.Invalid_Argument
Codes: time_out_of_range, invalid_argument, out_of_range, non_finite_number, cycle, unsupported_type, too_large, native_failure, live_children, wrong_kind, not_integral, inexact_number, missing_field, unknown_field, duplicate_field, too_deep, length_mismatch, malformed_tag, ambiguous_field, ambiguous_variant, invalid_value, hook_failed.
| When | Operations |
|---|---|
| the bundle, schemaPath or node is invalid or an input exceeds its limit | validate_schema |
the entity ID is outside the user entity range, max_depth is negative or above 32, or max_entities is negative | read_entity |
the text is malformed, the format is unknown or a number is outside i64 or finite f64 | parse |
| the format is unknown or the width is negative | serialize |
| the text is malformed, a format is unknown or the width is negative | convert |
| the node breaks the preorder rules or has an invalid kind or number | add |
| a node breaks the preorder rules or has an invalid kind or number | add_many |
| the builder has no root or a container is still open | seal |
| id is not a node of the document | read, pointer, child_iterator |
| start is past the last node or capacity is negative | read_many |
| id is not an object node of the document | member |
| the node is not an integer number | i64 |
the node is not a number or its value overflows f64 | f64 |
| the arguments include an undeclared macro parameter | build_macro, expand_macro |
the file is not a database, an option is invalid, selected plugins are incompatible, or a plugin refuses its settings: the error carries the plugin's code (such as unknown_plugin_setting), the plugin's name as its path and the setting at fault as its field (nested settings as dotted member names, ambiguous when a name holds a dot) | open |
| the parameters or run options are invalid | run |
| the parameters or subscription options are invalid | subscribe |
max_wait is negative | next, indexes_sync |
| the parameters or run options are invalid, or a required parameter has no value | run |
| the patch is not an entity-keyed object, or a link names an ID outside the user entity range | merge_patch |
| the kind, action, revision or page limits are invalid, or the selected plan cannot run the current authored definition | plan |
| the kind or the pattern is invalid | definitions |
| a bulk build is already in progress on the database | bulk_begin |
| no bulk build is in progress | bulk_add, bulk_finish |
| a name is empty, the plugin has no call operation with the name, or the plugin refuses the request | plugin_call |
| a name is empty, the plugin has no stream operation with the name, or the plugin refuses the request | plugin_stream |
| the stream has finished or does not accept writes | write |
| the stream does not support reads, or length is negative | read |
the stream does not support seeks, whence is unknown, or the position is negative or past the i64 range | seek |
| the stream has finished or has no finish step | finish |
| the token is empty or longer than 4096 bytes | activate |
| entity is not a user entity | objects_get, objects_path |
| the parent or the name is invalid, or the parent is a file | objects_lookup |
| the parent is invalid or is a file | objects_children |
| the digest is not a native SHA-256 value | objects_files, objects_manifest, objects_open |
| the array is empty or malformed, a name is invalid, or a parent is a file | objects_create |
the entity is a directory or invalid, the digest is malformed, or expected_revision is negative | objects_update |
| the request is malformed, the destination is a file or inside the node, the kinds differ, or a replaced directory is not empty | objects_move |
the entity is invalid, the directory is not empty, or expected_revision is negative | objects_remove |
| the request is not an object with only an integer owner | events_close_owner |
event is not an object with exactly subject and data, the subject is malformed (code invalid_subject), or data exceeds 1 MB (code too_large) | events_publish |
the request is malformed, or the pattern is empty or not a valid regular expression (code invalid_pattern) | events_subscribe |
options is not an object with owner and subscription (integers) and optionally a valid maxWait, or the subscription belongs to another owner (code wrong_owner) | events_receive |
the request is malformed, or the subscription belongs to another owner (code wrong_owner) | events_unsubscribe |
the request is malformed, the mode is unknown (code invalid_mode) or the pattern is empty or invalid (code invalid_pattern) | events_register |
the request is malformed, or the registration belongs to another owner (code wrong_owner) | events_unregister |
options is not an object with owner and registration (integers) and optionally a valid maxWait, or the registration belongs to another owner (code wrong_owner) | events_accept |
request is malformed, the mode or subject is invalid (codes invalid_mode and invalid_subject), data is missing for request or pull, present for push or duplex, or exceeds 1 MB, or data does not match the stored request schema (code invalid_payload) | events_call |
request is malformed, the side may not send now (code wrong_direction), the handle belongs to another owner (code wrong_owner), or data does not match its schema (code invalid_payload) | events_send |
the request is malformed, the side cannot finish in this mode (code wrong_direction), or the handle belongs to another owner (code wrong_owner) | events_finish |
the request is malformed, or the handle belongs to another owner (code wrong_owner) | events_cancel |
options is not an object with owner and handle (integers) and optionally a valid maxWait, or the handle belongs to another owner (code wrong_owner) | events_read |
| the request is malformed, the parameters do not fit the query, a selected target is a reserved field or not a data entity, or rows disagree about one entity field | blackholes_preview |
| the request is malformed, confirm is wrong, the parameters do not fit the query, a selected target is a reserved field or not a data entity, or rows disagree about one entity field | blackholes_execute |
| options is not an object, or an option is invalid or unsupported | blackholes_audit |
| options is not an object, or an option is invalid, duplicated or unsupported | backups_sync, sdk_sync, skills_sync |
.Invalid_JSON
.Compile_Failed
| When | Operations |
|---|---|
| the expression does not compile | build |
| the expansion does not compile | build_macro |
| the expanded expression does not compile | expression |
.Evaluation_Failed
| When | Operations |
|---|---|
| the validation work limit is exceeded | validate_schema |
| the expression fails on the input | evaluate |
the query fails, exceeds max_cost or exceeds its automatic work limit | run |
| the page does not render | next |
| a page does not render | page_iterator, all_pages |
| a rerun of the query failed. Every later call reports this failure | next |
| the mutation fails | run |
| the plugin cannot read its stored state | plugin_call, plugin_stream |
| stored bytes do not match their digest | read |
| stored tree metadata or the manifest of a named payload is corrupted | objects_get, objects_lookup, objects_children, objects_path |
| the stored manifest is corrupted | objects_manifest, objects_open |
| a replacement expression fails or exceeds its work limit. History stays unchanged | blackholes_preview, blackholes_execute |
.Out_Of_Memory
Codes: out_of_memory.
.Not_Found
Codes: not_found.
| When | Operations |
|---|---|
| the object has no member with the key | member |
| the macro refers to an unknown macro | build_macro, expand_macro |
| the parent directory is missing, or the file is missing and create is false | open |
| no definition is stored at the path | query, mutation, definition |
| no expression is stored at the path | expression |
| the stored query definition was deleted | run |
| the definition or exact historical plan revision does not exist | plan |
| the plugin reports that the request names nothing it holds | plugin_call, plugin_stream |
| no object node has the entity | objects_get |
| the parent has no child with the name, or the parent does not exist | objects_lookup |
| the parent does not exist | objects_children |
| the node or one of its ancestors does not exist | objects_path |
| no payload with the digest is published | objects_manifest, objects_open |
| a parent does not exist or a digest is not published | objects_create |
| the file does not exist or the digest is not published | objects_update |
| the node or the destination does not exist | objects_move |
| the node does not exist | objects_remove |
| the owner does not exist or ended | events_close_owner |
| the owner does not exist | events_subscribe, events_register |
| the owner or the subscription does not exist | events_receive |
| the owner or the subscription does not exist or ended | events_unsubscribe |
| the owner or the registration does not exist | events_unregister, events_accept |
the owner does not exist, or no registered worker matches (code no_worker) | events_call |
| the owner or the side does not exist, or the exchange ended and the side drained | events_send |
| the owner or the side does not exist | events_finish, events_cancel |
| the owner or the side does not exist, or it drained after the exchange ended | events_read |
no definition has the path (code not_found), or the selection has no assertion to rewrite (code no_match) | blackholes_preview, blackholes_execute |
.Locked
| When | Operations |
|---|---|
another process holds the lock after lock_timeout | open |
.Conflict
| When | Operations |
|---|---|
an enabled plugin finds the database inconsistent with its copies: backups refuse diverging copies with code backup_history_divergent, naming them | open |
| concurrent writes prevent the commit | run |
| an entity revision check fails or a concurrent writer prevents the commit; a revision mismatch reports the entity and expected and actual revisions | merge_patch |
| the authored definition or accepted plan changed before the explicit control committed | plan |
| another write committed to the database during the build | bulk_finish |
| the plugin's write lost to a concurrent change, or the database holds writes | plugin_call |
| the database holds writes | plugin_stream, finish, objects_upload |
| the database holds writes while the plugin stores the bytes | write |
| a name is already taken in its parent or appears twice, or the database holds writes | objects_create |
expected_revision is stale, or the database holds writes | objects_update, objects_remove |
the name is occupied without replace, expected_revision is stale, or the database holds writes | objects_move |
the side already finished (code already_finished), or the other party's queue is full (code delivery_failed) | events_send, events_finish |
| the definition, parameters, selection or history changed since the preview, or the digest names another request | blackholes_execute |
.Invalid_Definition
| When | Operations |
|---|---|
| a schema cannot compile or a reference cannot resolve | validate_schema |
| the macro is invalid or expands recursively | build_macro, expand_macro |
| the definition is invalid | query, mutation |
| a macro it calls is invalid or expands recursively | expression |
| the loaded query definition is invalid | run |
| the query or its callable definitions are invalid | subscribe |
| the mutation selection or definition is invalid | run |
| the patched definition is invalid | patch_definition |
.Schema_Violation
| When | Operations |
|---|---|
| the selected instance does not match the schema | validate_schema |
| the write breaks a schema | run |
.Invalid_Commit_Time
| When | Operations |
|---|---|
the #_tx commit time is not later than the last commit | merge_patch |
.Closed
Codes: closed.
.Rejected
| When | Operations |
|---|---|
| a mutation target or write guard refuses the write | run |
| the database refuses the patch; the code and diagnostic path name the reason and key | merge_patch |
| a validator of an enabled plugin refused the definition, such as an event definition outside a mode or with a schema that does not compile | patch_definition |
| the database refuses the patch; the build has failed and later adds report the same status | bulk_add |
| the database refuses a patch; an initial build publishes nothing and fallback keeps earlier commits | bulk_finish |
.Unsupported
Codes: abi_version, core_digest, unsupported_runtime, abi_layout, abi_symbol.
| When | Operations |
|---|---|
| found differs from the ABI version of the binding | check_version |
| a selected plugin has no implementation on this platform: the filesystem plugin on Windows | open |
.Cancelled
Codes: cancelled.
| When | Operations |
|---|---|
| the subscription is cancelled or closed | next |
.Timeout
| When | Operations |
|---|---|
max_wait passed first | indexes_sync |
| the plugin's wait passed its limit | plugin_call |
| maxWait passed before an event arrived | events_receive |
| maxWait passed before an exchange arrived | events_accept |
| maxWait passed before a notice arrived | events_read |
| maxWait passed before every target confirmed | backups_sync |
| maxWait passed before the work finished | sdk_sync, skills_sync |
.Unavailable
| When | Operations |
|---|---|
an enabled plugin cannot reach what the open needs: backups refuse with backup_targets_unreachable, backup_target_unreadable or backup_objects_required; filesystem refuses with filesystem_fuse_unavailable or filesystem_mount_failed, naming the mount point; the events plugin is required when the database stores event definitions (plugin_required) | open |
| the patch sets stardust/history and no enabled plugin purges history | run, merge_patch |
| the plugin is unknown or the database does not enable it | plugin_call, plugin_stream |
| the database does not enable the objects plugin | objects_get, objects_lookup, objects_children, objects_path, objects_files, objects_manifest, objects_create, objects_update, objects_move, objects_remove, objects_upload, objects_open |
| the database does not enable the reactors plugin | reactors_status |
| the database does not enable the events plugin | events_status, events_open_owner, events_close_owner, events_publish, events_subscribe, events_receive, events_unsubscribe, events_register, events_unregister, events_accept, events_call, events_send, events_finish, events_cancel, events_read |
| the database does not enable the blackholes plugin | blackholes_preview, blackholes_audit, blackholes_status |
| the database does not enable the blackholes plugin, an earlier execution is still recovering, an index covers a selected field and cannot be repaired, or a backup target cannot take the blackhole | blackholes_execute |
| the database does not enable the backups plugin | backups_status, backups_sync |
| the database does not enable the sdk plugin | sdk_status, sdk_sync |
| the database does not enable the skills plugin | skills_status, skills_sync |
.Failed
| When | Operations |
|---|---|
| a reactor fails; the initiating write and all derived changes are rolled back | run, merge_patch |
| a reactor fails; the definition and all derived changes are rolled back | patch_definition |
| a reactor fails while committing this patch; earlier fallback patches remain committed | bulk_add |
| a reactor failed while adding a fallback patch; earlier patches remain committed | bulk_finish |
| the plugin's work failed | plugin_call |
| the plugin's work failed; status describes the failure | backups_sync, sdk_sync, skills_sync |
.Unlicensed
Codes: unlicensed.
| When | Operations |
|---|---|
| the token is refused; the error names the reason | activate |
.Invalid_Pointer
| When | Operations |
|---|---|
| the text is not a JSON Pointer or the array is not a canonical path array | pointer |
| the text is not empty and does not start with /, or holds ~ not followed by 0 or 1 | pointer_parse |
| a token is a negative or non-integral number, an index-shaped string such as "0", or neither a number nor a string | pointer_format |
Refusal examples
The generator captured each result from the native library.
Describe the backup runtime
failed, result := stardust.backups_status(db)
defer stardust.close(&failed)
defer stardust.close(&result){violations null
code unavailable
message the plugin is not enabled
path null
field null
entity null
offset null
status unavailable}Wait until every target stored the history
sync_options := stardust.parse(`{maxWait {#dur PT5S}}`, .DUST) or_return
defer stardust.close(&sync_options)
result := stardust.backups_sync(db, sync_options)
defer stardust.close(&result){violations null
code unavailable
message the plugin is not enabled
path null
field null
entity null
offset null
status unavailable}convert
duplicate_text holds this document:
'{:a 1 :a 2}'
source := stardust.parse(duplicate_text, .DUST) or_return
defer stardust.close(&source)
view := stardust.read(source, stardust.root(source) or_return) or_return
failed, result := stardust.parse(view.text, .EDN)
defer stardust.close(&failed)
defer stardust.close(&result){violations null
code invalid_edn
message invalid EDN (Duplicate_Key) at offset 6
path null
field null
entity null
offset 6
status invalid_argument}Refuse a metadata-only transaction
patch_text holds this document:
#_tx {author x}
patch := stardust.parse(patch_text, .DUST) or_return
defer stardust.close(&patch)
commit, result := stardust.merge_patch(db, patch)
defer stardust.close(&commit)
defer stardust.close(&result){violations null
code transaction_only
message a patch of only #_tx is refused: #_tx annotates a write
path #_tx
field null
entity null
offset null
status rejected}Refuse a repeated commit time
future_text holds this document:
#_d {x 1}
#_tx {stardust/committedAt {#utc 2200-01-01T00:00:00Z}}
older_text holds this document:
#_e {x 2}
#_tx {stardust/committedAt {#utc 2200-01-01T00:00:00Z}}
future := stardust.parse(future_text, .DUST) or_return
defer stardust.close(&future)
committed := stardust.merge_patch(db, future) or_return
defer stardust.close(&committed)
patch := stardust.parse(older_text, .DUST) or_return
defer stardust.close(&patch)
commit, result := stardust.merge_patch(db, patch)
defer stardust.close(&commit)
defer stardust.close(&result){violations null
code invalid_commit_time
message stardust/committedAt must be strictly newer than the latest commit time
path null
field null
entity null
offset null
status invalid_commit_time}Refuse an invalid query definition
query_text holds this document:
find [?x]
definition := stardust.parse(query_text, .DUST) or_return
defer stardust.close(&definition)
query, result := stardust.query(db, definition)
defer stardust.close(&query)
defer stardust.close(&result){violations null
code unbound_variable
message Unbound_Variable
path null
field null
entity null
offset null
status invalid_definition}Report a missing stored query
query, result := stardust.query(db, "people/missing")
defer stardust.close(&query)
defer stardust.close(&result){violations null
code not_found
message no definition at this path
path people/missing
field null
entity null
offset null
status not_found}Report a malformed byte at offset zero
malformed holds these bytes:
]
failed, result := stardust.parse(malformed, .DUST)
defer stardust.close(&failed)
defer stardust.close(&result){violations null
code invalid_dust
message Invalid_Syntax at offset 0
path null
field null
entity null
offset 0
status invalid_argument}Report malformed DUST
malformed holds these bytes:
[
failed, result := stardust.parse(malformed, .DUST)
defer stardust.close(&failed)
defer stardust.close(&result){violations null
code invalid_dust
message Unexpected_End at offset 2
path null
field null
entity null
offset 2
status invalid_argument}Refuse a positive sub-tick duration
query_text holds this document:
find [?name]
where [[?e name ?name]]
orderBy [?name]
boundary_text holds this document:
99
definition := stardust.parse(query_text, .DUST) or_return
defer stardust.close(&definition)
query := stardust.query(db, definition) or_return
defer stardust.close(&query)
boundary := stardust.parse(boundary_text, .DUST) or_return
defer stardust.close(&boundary)
nanoseconds := stardust.i64(boundary, stardust.root(boundary) or_return) or_return
options := stardust.Run_Options{page_size = 2, max_cost = time.Duration(nanoseconds)}
rows, result := stardust.run(query, options = options)
defer stardust.close(&rows)
defer stardust.close(&result){violations null
code inexact_number
message The number has no exact form in the target type: duration requires whole 100 ns ticks
path null
field null
entity null
offset null
status invalid_argument}