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

LanguageFailure
CReturns a status. The owner that its operation names holds the diagnostic.
GoReturns *Error.
RustReturns Result<_, Error>.
ClojureThrows clojure.lang.ExceptionInfo with diagnostic data.
PythonRaises StardustError.
OdinReturns 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.

FieldTypeUnitAbsentMeaning
violations[]map[string]anyNone—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.
codestringNone——
messagestringNone——
path*stringNonenil—
field*stringNonenil—
entity*int64Nonenil—
offset*int64Bytesnil—
statusStatusNone——

Statuses

Each status names a class of failure. The table lists codes from the binding. Native diagnostic codes can differ.

StatusInvalidArgument

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.

WhenOperations
the bundle, schemaPath or node is invalid or an input exceeds its limitValidateSchema
the entity ID is outside the user entity range, max_depth is negative or above 32, or max_entities is negativeDatabase.ReadEntity
the text is malformed, the format is unknown or a number is outside i64 or finite f64Parse
the format is unknown or the width is negativeDocument.Serialize
the text is malformed, a format is unknown or the width is negativeConvert
the value has a host type with no document form (one the language's standard JSON encoder also refuses), a number outside i64 or finite f64, a decimal or time with no exact native form, a failing conversion method, or a cycleFromValue
the node breaks the preorder rules or has an invalid kind or numberBuilder.Add
a node breaks the preorder rules or has an invalid kind or numberBuilder.AddMany
the builder has no root or a container is still openBuilder.Seal
id is not a node of the documentDocument.Read, Document.Pointer, Document.Children
start is past the last node or capacity is negativeDocument.ReadMany
id is not an object node of the documentDocument.Member, Document.Members
a path token is neither a string nor an int or int64Document.Pointer, pointer.Format
the node is not an integer numberDocument.I64
the node is not a number or its value overflows f64Document.F64
the arguments include an undeclared macro parameterBuildMacro, ExpandMacro
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 invalidQuery.Run
the parameters or subscription options are invalidQuery.Subscribe
max_wait is negativeSubscription.Next, Database.IndexesSync
the parameters or run options are invalid, or a required parameter has no valueMutation.Run
the patch is not an entity-keyed object, or a link names an ID outside the user entity rangeDatabase.MergePatch
the kind, action, revision or page limits are invalid, or the selected plan cannot run the current authored definitionDatabase.Plan
the kind or the pattern is invalidDatabase.Definitions
a bulk build is already in progress on the databaseDatabase.BulkBegin
no bulk build is in progressDatabase.BulkAdd, Database.BulkFinish
a name is empty, the plugin has no call operation with the name, or the plugin refuses the requestDatabase.PluginCall
a name is empty, the plugin has no stream operation with the name, or the plugin refuses the requestDatabase.PluginStream
the stream has finished or does not accept writesPluginStream.Write
the stream does not support reads, or length is negativePluginStream.Read
the stream does not support seeks, whence is unknown, or the position is negative or past the i64 rangePluginStream.Seek
the stream has finished or has no finish stepPluginStream.Finish
the token is empty or longer than 4096 bytesActivate
entity is not a user entityObjects.Get, Objects.Path
the parent or the name is invalid, or the parent is a fileObjects.Lookup
the parent is invalid or is a fileObjects.Children
the digest is not a native SHA-256 valueObjects.Files, Objects.Manifest, Objects.Open
the array is empty or malformed, a name is invalid, or a parent is a fileObjects.Create
the entity is a directory or invalid, the digest is malformed, or expected_revision is negativeObjects.Update
the request is malformed, the destination is a file or inside the node, the kinds differ, or a replaced directory is not emptyObjects.Move
the entity is invalid, the directory is not empty, or expected_revision is negativeObjects.Remove
the request is not an object with only an integer ownerEvents.CloseOwner
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 fieldBlackholes.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 fieldBlackholes.Execute
options is not an object, or an option is invalid or unsupportedBlackholes.Audit
options is not an object, or an option is invalid, duplicated or unsupportedBackups.Sync, Sdk.Sync, Skills.Sync

StatusInvalidJSON

WhenOperations
JSON text is malformedParse, Convert

StatusCompileFailed

WhenOperations
the expression does not compileBuild
the expansion does not compileBuildMacro
the expanded expression does not compileDatabase.Expression

StatusEvaluationFailed

WhenOperations
the validation work limit is exceededValidateSchema
the expression fails on the inputProgram.Evaluate
the query fails, exceeds max_cost or exceeds its automatic work limitQuery.Run
the page does not renderRows.Next
a page does not renderRows.Pages, Rows.AllPages
a rerun of the query failed. Every later call reports this failureSubscription.Next
a rerun of the query failedSubscription.All
the mutation failsMutation.Run
the plugin cannot read its stored stateDatabase.PluginCall, Database.PluginStream
stored bytes do not match their digestPluginStream.Read
stored tree metadata or the manifest of a named payload is corruptedObjects.Get, Objects.Lookup, Objects.Children, Objects.Path
the stored manifest is corruptedObjects.Manifest, Objects.Open
a replacement expression fails or exceeds its work limit. History stays unchangedBlackholes.Preview, Blackholes.Execute

StatusOutOfMemory

Codes: out_of_memory.

StatusNotFound

Codes: not_found.

WhenOperations
the object has no member with the keyDocument.Member
the macro refers to an unknown macroBuildMacro, ExpandMacro
the parent directory is missing, or the file is missing and create is falseOpen
no definition is stored at the pathDatabase.Query, Database.Mutation, Database.Definition
no expression is stored at the pathDatabase.Expression
the stored query definition was deletedQuery.Run
the definition or exact historical plan revision does not existDatabase.Plan
the plugin reports that the request names nothing it holdsDatabase.PluginCall, Database.PluginStream
no object node has the entityObjects.Get
the parent has no child with the name, or the parent does not existObjects.Lookup
the parent does not existObjects.Children
the node or one of its ancestors does not existObjects.Path
no payload with the digest is publishedObjects.Manifest, Objects.Open
a parent does not exist or a digest is not publishedObjects.Create
the file does not exist or the digest is not publishedObjects.Update
the node or the destination does not existObjects.Move
the node does not existObjects.Remove
the owner does not exist or endedEvents.CloseOwner
the owner does not existEvents.Subscribe, Events.Register
the owner or the subscription does not existEvents.Receive
the owner or the subscription does not exist or endedEvents.Unsubscribe
the owner or the registration does not existEvents.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 drainedEvents.Send
the owner or the side does not existEvents.Finish, Events.Cancel
the owner or the side does not exist, or it drained after the exchange endedEvents.Read
no definition has the path (code not_found), or the selection has no assertion to rewrite (code no_match)Blackholes.Preview, Blackholes.Execute

StatusLocked

WhenOperations
another process holds the lock after lock_timeoutOpen

StatusConflict

WhenOperations
an enabled plugin finds the database inconsistent with its copies: backups refuse diverging copies with code backup_history_divergent, naming themOpen
concurrent writes prevent the commitMutation.Run
an entity revision check fails or a concurrent writer prevents the commit; a revision mismatch reports the entity and expected and actual revisionsDatabase.MergePatch
the authored definition or accepted plan changed before the explicit control committedDatabase.Plan
another write committed to the database during the buildDatabase.BulkFinish
the plugin's write lost to a concurrent change, or the database holds writesDatabase.PluginCall
the database holds writesDatabase.PluginStream, PluginStream.Finish, Objects.Upload
the database holds writes while the plugin stores the bytesPluginStream.Write
a name is already taken in its parent or appears twice, or the database holds writesObjects.Create
expected_revision is stale, or the database holds writesObjects.Update, Objects.Remove
the name is occupied without replace, expected_revision is stale, or the database holds writesObjects.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 requestBlackholes.Execute

StatusInvalidDefinition

WhenOperations
a schema cannot compile or a reference cannot resolveValidateSchema
the macro is invalid or expands recursivelyBuildMacro, ExpandMacro
the definition is invalidDatabase.Query, Database.Mutation
a macro it calls is invalid or expands recursivelyDatabase.Expression
the loaded query definition is invalidQuery.Run
the query or its callable definitions are invalidQuery.Subscribe
the mutation selection or definition is invalidMutation.Run
the patched definition is invalidDatabase.PatchDefinition

StatusSchemaViolation

WhenOperations
the selected instance does not match the schemaValidateSchema
the write breaks a schemaMutation.Run

StatusInvalidCommitTime

WhenOperations
the #_tx commit time is not later than the last commitDatabase.MergePatch

StatusClosed

Codes: closed.

WhenOperations
the database is closedDatabase.ReadEntity, Database.Query, Database.Mutation, Database.Expression, Database.MergePatch, Database.Definition, Database.Plan, Database.Definitions, Database.PatchDefinition, Database.IndexesSync, Database.BulkBegin, Database.BulkAdd, Database.BulkFinish, Database.PluginCall, Database.PluginStream, Objects.Get, Objects.Lookup, Objects.Children, Objects.Path, Objects.Files, Objects.Manifest, Objects.Create, Objects.Update, Objects.Move, Objects.Remove, Objects.Upload, Objects.Open, Reactors.Status, Events.Status, Events.OpenOwner, Events.CloseOwner, Events.Publish, Events.Subscribe, Events.Receive, Events.Unsubscribe, Events.Register, Events.Unregister, Events.Accept, Events.Call, Events.Send, Events.Finish, Events.Cancel, Events.Read, Blackholes.Preview, Blackholes.Execute, Blackholes.Audit, Blackholes.Status, Backups.Status, Backups.Sync, Sdk.Status, Sdk.Sync, Skills.Status, Skills.Sync
the document is closedDocument.Serialize, Document.ToValue, Document.Root, Document.Count, Document.Read, Document.ReadMany, Document.Member, Document.Pointer, Document.Children, Document.Members, Document.I64, Document.F64
the builder is closedBuilder.Add, Builder.AddMany, Builder.Seal
the program is closedProgram.Evaluate
the query is closedQuery.Run, Query.Subscribe
the rows is closedRows.Next, Rows.Pages, Rows.AllPages
the subscription is closedSubscription.Next
the mutation is closedMutation.Run
the plugin_stream is closedPluginStream.Write, PluginStream.Read, PluginStream.Seek, PluginStream.Finish

StatusRejected

WhenOperations
a mutation target or write guard refuses the writeMutation.Run
the database refuses the patch; the code and diagnostic path name the reason and keyDatabase.MergePatch
a validator of an enabled plugin refused the definition, such as an event definition outside a mode or with a schema that does not compileDatabase.PatchDefinition
the database refuses the patch; the build has failed and later adds report the same statusDatabase.BulkAdd
the database refuses a patch; an initial build publishes nothing and fallback keeps earlier commitsDatabase.BulkFinish

StatusUnsupported

Codes: abi_version, core_digest, unsupported_runtime, abi_layout, abi_symbol.

WhenOperations
found differs from the ABI version of the bindingCheckVersion
a selected plugin has no implementation on this platform: the filesystem plugin on WindowsOpen

StatusCancelled

Codes: cancelled.

WhenOperations
the subscription is cancelled or closedSubscription.Next

StatusTimeout

WhenOperations
max_wait passed firstDatabase.IndexesSync
the plugin's wait passed its limitDatabase.PluginCall
maxWait passed before an event arrivedEvents.Receive
maxWait passed before an exchange arrivedEvents.Accept
maxWait passed before a notice arrivedEvents.Read
maxWait passed before every target confirmedBackups.Sync
maxWait passed before the work finishedSdk.Sync, Skills.Sync

StatusUnavailable

WhenOperations
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 historyMutation.Run, Database.MergePatch
the plugin is unknown or the database does not enable itDatabase.PluginCall, Database.PluginStream
the database does not enable the objects pluginObjects.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 pluginReactors.Status
the database does not enable the events pluginEvents.Status, Events.OpenOwner, Events.CloseOwner, 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 pluginBlackholes.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 blackholeBlackholes.Execute
the database does not enable the backups pluginBackups.Status, Backups.Sync
the database does not enable the sdk pluginSdk.Status, Sdk.Sync
the database does not enable the skills pluginSkills.Status, Skills.Sync

StatusFailed

WhenOperations
a reactor fails; the initiating write and all derived changes are rolled backMutation.Run, Database.MergePatch
a reactor fails; the definition and all derived changes are rolled backDatabase.PatchDefinition
a reactor fails while committing this patch; earlier fallback patches remain committedDatabase.BulkAdd
a reactor failed while adding a fallback patch; earlier patches remain committedDatabase.BulkFinish
the plugin's work failedDatabase.PluginCall
the plugin's work failed; status describes the failureBackups.Sync, Sdk.Sync, Skills.Sync

StatusUnlicensed

Codes: unlicensed.

WhenOperations
the token is refused; the error names the reasonActivate

StatusInvalidPointer

WhenOperations
the text is not a JSON Pointer or the array is not a canonical path arrayDocument.Pointer
the text is not empty and does not start with /, or holds ~ not followed by 0 or 1pointer.Parse
a token is a negative or non-integral number, an index-shaped string such as "0", or neither a number nor a stringpointer.Format

Refusal examples

The generator captured each result from the native library.

Describe the backup runtime

go151 B
failed, err := db.Backups().Status()
if failed != nil {
	defer failed.Close()
}

var result *stardust.Error
if !errors.As(err, &result) {
	return err
}
Result / 187 B
{
  "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

go246 B
syncOptions, err := stardust.Parse([]byte(`{maxWait {#dur PT5S}}`), stardust.DUST)
if err != nil {
	return err
}
defer syncOptions.Close()
err = db.Backups().Sync(syncOptions)
var result *stardust.Error
if !errors.As(err, &result) {
	return err
}
Result / 187 B
{
  "violations": null,
  "code": "unavailable",
  "message": "the plugin is not enabled",
  "path": null,
  "field": null,
  "entity": null,
  "offset": null,
  "status": "unavailable"
}

convert

duplicateText holds this document:

json14 B
"{:a 1 :a 2}"
go339 B
source, err := stardust.Parse(duplicateText, stardust.JSON)
if err != nil {
	return err
}
defer source.Close()

root, err := source.Root()
if err != nil {
	return err
}
view, err := source.Read(root)
if err != nil {
	return err
}

failed, result := stardust.Parse([]byte(view.Text), stardust.EDN)
if failed != nil {
	defer failed.Close()
}
Result / 203 B
{
  "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

patchText holds this document:

json38 B
{
  "#_tx": {
    "author": "x"
  }
}
go144 B
patch, err := stardust.Parse(patchText, stardust.JSON)
if err != nil {
	return err
}
defer patch.Close()

_, result := db.MergePatch(patch, nil)
Result / 221 B
{
  "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

futureText holds this document:

json120 B
{
  "#_d": {
    "x": 1
  },
  "#_tx": {
    "stardust/committedAt": {
      "#utc": "2200-01-01T00:00:00Z"
    }
  }
}

patchText holds this document:

json120 B
{
  "#_e": {
    "x": 2
  },
  "#_tx": {
    "stardust/committedAt": {
      "#utc": "2200-01-01T00:00:00Z"
    }
  }
}
go322 B
future, err := stardust.Parse(futureText, stardust.JSON)
if err != nil {
	return err
}
defer future.Close()

if _, err := db.MergePatch(future, nil); err != nil {
	return err
}

patch, err := stardust.Parse(patchText, stardust.JSON)
if err != nil {
	return err
}
defer patch.Close()

_, result := db.MergePatch(patch, nil)
Result / 249 B
{
  "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

queryText holds this document:

json29 B
{
  "find": [
    "?x"
  ]
}
go194 B
definition, err := stardust.Parse(queryText, stardust.JSON)
if err != nil {
	return err
}
defer definition.Close()

query, result := db.Query(definition)
if query != nil {
	defer query.Close()
}
Result / 190 B
{
  "violations": null,
  "code": "unbound_variable",
  "message": "Unbound_Variable",
  "path": null,
  "field": null,
  "entity": null,
  "offset": null,
  "status": "invalid_definition"
}

Report a missing stored query

go88 B
query, result := db.QueryPath("people/missing")
if query != nil {
	defer query.Close()
}
Result / 196 B
{
  "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

malformedText holds these bytes:

text1 B
]
go105 B
failed, result := stardust.Parse(malformedText, stardust.DUST)
if failed != nil {
	defer failed.Close()
}
Result / 191 B
{
  "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

malformedText holds these bytes:

text1 B
[
go174 B
failed, err := stardust.Parse(malformedText, stardust.DUST)
if failed != nil {
	defer failed.Close()
}

var result *stardust.Error
if !errors.As(err, &result) {
	return err
}
Result / 191 B
{
  "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

boundaryText holds this document:

json3 B
99

queryText holds this document:

json134 B
{
  "find": [
    "?name"
  ],
  "where": [
    [
      "?e",
      "name",
      "?name"
    ]
  ],
  "orderBy": [
    "?name"
  ]
}
go676 B
definition, err := stardust.Parse(queryText, stardust.JSON)
if err != nil {
	return err
}
defer definition.Close()

query, err := db.Query(definition)
if err != nil {
	return err
}
defer query.Close()

boundary, err := stardust.Parse(boundaryText, stardust.JSON)
if err != nil {
	return err
}
defer boundary.Close()

boundaryRoot, err := boundary.Root()
if err != nil {
	return err
}
nanoseconds, err := boundary.I64(boundaryRoot)
if err != nil {
	return err
}

rows, err := query.Run(nil, stardust.RunOptions{PageSize: 2, MaxCost: time.Duration(nanoseconds)}, nil)
if rows != nil {
	defer rows.Close()
}

var result *stardust.Error
if !errors.As(err, &result) {
	return err
}
Result / 255 B
{
  "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"
}