Skip to content

Type Alias: TermWriteErrorCode

@kortexya/reasoninglayer


@kortexya/reasoninglayer / TermWriteErrorCode

TermWriteErrorCode = "write_creates_rule" | "governed_sort_write_refused" | "reference_term_unknown" | "term_id_unavailable" | "engine_feature_write_refused"

Defined in: src/types/terms.ts:645

The code of a coded refusal that a term write door answers.

  • write_creates_rule (422) — the write carries a non-empty list under the feature when, which would make the term a RULE. Create a rule through client.inference (the rule routes) or OSFQL DERIVE. A scalar when is ordinary data.
  • governed_sort_write_refused (409) — the term’s sort is @governed, or descends from a governed sort: its terms are written and removed only by the engine, for every caller. POST, PUT, PATCH and DELETE on /api/v1/terms answer it, and so does a bulk retract with a governed member; nothing is applied.
  • reference_term_unknown (422) — a feature references a term that does not exist, or one the caller’s Read grant does not show; both answer alike (reasoninglayer#1212). POST /api/v1/terms, PUT /api/v1/terms/{id} and POST /api/v1/inference/facts answer it; a bulk write names the row instead (BulkRowRefusal.code). Nothing is written.
  • term_id_unavailable (409) — the explicit id of a POST /api/v1/terms is held by a term the caller’s Read grant hides; the message names only that id, and nothing is written (reasoninglayer#1215). An RDF import or a SPARQL INSERT DATA that names such a resource answers it too (error_type on the SPARQL body). A frame comment whose id a term already holds answers it as well (409, #1265); name another id.
  • engine_feature_write_refused (422) — the write names a feature only the engine writes: a runtime-record tag such as _pref_user, or bookkeeping such as _derived_by (reasoninglayer#1269). POST and PUT /api/v1/terms, POST /api/v1/inference/facts and the agent-belief route answer it; a bulkCreateTerms row names the feature. No principal is exempt, and nothing is written.

Read any of these codes with errorBodyCode(error). For write_creates_rule, POST /api/v1/terms, PUT /api/v1/terms/{id} and POST /api/v1/inference/facts answer an ApiError (status 422); a bulk write does not throw it: bulkCreateTerms names the row in BulkRefusedError.rows with feature: 'when', and bulkAddFacts lists the fact in rejected with the same message.

const code: TermWriteErrorCode = 'write_creates_rule';