ReferenceRust API
RSL diagnostics
Every schema error includes its file, line, column, and a stable RSL code. Run rent validate for semantic
validation or rent validate --syntax-only while repairing incomplete syntax.
Syntax
| Code | Meaning | Fix |
|---|---|---|
RSL000 | Source text could not be mapped to a valid UTF-8 span. | Save the schema as UTF-8 and retry. |
RSL001 | The lexer reached an unexpected character. | Remove the character or place the value in a quoted string. |
RSL002 | A string, escape, or block comment is incomplete. | Close it and check escapes near the reported location. |
RSL003 | The top-level declaration is unknown. | Use datasource, generator, model, view, enum, type, extension, tenancy, access, or permissions. |
RSL004 | The parser expected another token or expression. | Check delimiters, attribute arguments, and the preceding line. |
RSL005 | List and nullable modifiers were combined. | Use a non-null list, or Json? @rent.rustType("Vec<String>") for a nullable stored collection. |
Schema meaning
| Code | Meaning | Fix |
|---|---|---|
RSL200 | The normalized schema violates a cross-model invariant. | Read the attached invariant message. It names the entity, field, relationship, or index. |
RSL201 | A view has no SQL definition. | Add @@rent.sql("..."). |
RSL202 | @rent.version uses an incompatible field type. | Use required UInt or BigInt. |
RSL203 | A field type is unknown. | Use a built-in, enum, composite type, or an explicitly mapped unsupported database type. |
RSL204 | A default value, function argument, or automatic timestamp declaration is invalid. | Match the field type. Use uuid()/uuid(4)/uuid(7), now(), autoincrement(), or dbgenerated("SQL"). Use @updatedAt on a mutable timestamp field. |
RSL205 | Relationship fields and references have different lengths. | Supply one referenced field for every local foreign-key field. |
RSL206 | An inverse relationship has no matching forward relationship. | Add the matching relationship on the target model and use the same relationship name when needed. |
RSL207 | An index declaration is malformed. | Provide a valid field list and valid field options. |
RSL208 | An attribute argument that must list field names is not an array of field names. | Write the argument as [field, other_field]. |
RSL209 | A required attribute argument is missing. | Add the argument named in the diagnostic, such as name on @@rent.check, @@rent.trigger, @@rent.policy, or @rent.through, field on @rent.order, or table on @rent.join. |
RSL210 | Primary-key metadata is invalid. | Use one required field-level @id, or one @@id([...]) containing required fields. |
RSL211 | Join-table storage metadata is invalid. | Supply the required table, two columns, and at most two constraint names. |
RSL212 | A declaration name is duplicated. | Rename or remove one model, view, enum, or composite type. |
RSL213 | A field or enum value is duplicated. | Keep each name unique inside its declaration. |
RSL214 | A singleton or named configuration block is duplicated. | Keep one datasource and unique generator and extension names. |
RSL215 | An attribute is unknown for that declaration. | Correct the spelling or move the attribute to a supported owner. For @@check, use @@rent.check(name:, expression:). |
RSL216 | A non-repeatable attribute appears more than once. | Keep one copy. Indexes, unique constraints, policies, checks, and triggers remain repeatable where appropriate. |
RSL217 | An attribute argument is unknown. | Correct the argument name or remove it. |
RSL218 | A named attribute argument is duplicated. | Keep one value for that argument. |
RSL219 | A configuration property is unknown, including a datasource property Rent reads from elsewhere (url, directUrl, shadowDatabaseUrl, relationMode, schemas, extensions). | Correct the property name or remove it. The message names where that setting lives in Rent. |
RSL220 | A configuration property is duplicated. | Keep one value for that property. |
RSL221 | A required configuration property is missing. | Add provider to the datasource block, or name to an extension block. |
RSL222 | A relationship cannot infer its identity or join endpoints safely. | Declare explicit fields and references. Use an explicit join model for compound many-to-many data. When a modeled join references either endpoint model more than once, provide both source and target, naming distinct forward relations to the correct models. |
RSL223 | An enum default uses an unknown variant or the wrong value shape. | Use an unquoted declared variant, or an array of variants for a list. Do not use the mapped database strings. |
RSL224 | An enum has no variants or ambiguous stored values. | Declare at least one variant and give each variant a distinct, nonempty database value. |
RSL225 | A storage mapping has an invalid argument. | Give @map or @@map exactly one nonempty quoted string. |
RSL226 | A JSON default contains invalid JSON. | Put a valid JSON document inside the quoted default string. |
RSL227 | A typed list default has the wrong shape, element type, or numeric range. | Use an array of values matching the declared type. Timestamps need an offset, UUIDs must parse, and bytes must be between 0 and 255. |
RSL228 | A native extension field is declared outside a PostgreSQL datasource, as a list, or as a primary key. | Use a PostgreSQL datasource and declare the field as a scalar that is not the primary key. |
RSL229 | @@rent.native has arguments, or an enum uses @@map or @@schema without @@rent.native. | Declare @@rent.native with no arguments and name the SQL type with @@map and @@schema. |
RSL230 | An attribute cannot apply to a JSON value object. | Use literal defaults and mapped names on JSON members. Put database constraints and callbacks on model fields. |
RSL231 | A @db.* native type is used with no datasource provider to key it to. | Add datasource db { provider = "postgresql" } (or your provider), or name the dialect with @rent.type(postgres: ...). |
RSL232 | @@fulltext is used off PostgreSQL, has no sources, references an unknown or unsupported path, ends at a non-String or generated source, has an invalid configuration name, or its search_vector column is already declared. | Declare a PostgreSQL datasource, select stored String fields or String members of typed value objects, use a lowercase configuration such as english, and remove any hand-declared search_vector. |
RSL233 | Two members of one model become the same snake_case identifier. | Rename one member. Generated Rust and SQL names are snake_case. |
RSL234 | @@rent.derive or @@rent.attribute has a missing, empty, or non-string argument. | Quote Rust source: derive paths such as "utoipa::ToSchema", one attribute body such as "ts(export)". |
RSL235 | A tenancy block has a scope other than "required" or "none", a required scope names no field, or a none scope names one. | Write tenancy { scope = "required" field = "tenant_id" }, or tenancy { scope = "none" } with no field. |
RSL236 | A model has a tenant_id field but the schema declares no tenancy block. | Add tenancy { scope = "required" field = "tenant_id" } to scope every model, or tenancy { scope = "none" } if tenant_id is ordinary data. |
RSL237 | A tenant-scoped model has no tenant field. | Add the field, or mark the model @@rent.system if its rows belong to no tenant. |
RSL238 | A tenant field is optional or is not a BigInt or String. | Declare it as a required BigInt or String, or mark the model @@rent.system. |
RSL239 | Tenant-scoped models disagree on the tenant key type. | Use one type, BigInt or String, for every model's tenant field. |
RSL240 | A unique constraint on a tenant-scoped model omits the tenant field. | Include the tenant field to make it unique per tenant, or add global: true if one value must be unique across every tenant. |
RSL241 | A where: partial index is declared for MySQL or MariaDB, which have no partial indexes. | Use PostgreSQL or SQLite for the model, or drop the condition. |
RSL242 | An enum whose variants carry data has a block attribute other than @@rent.derive or @@rent.attribute, or a variant field has an attribute other than @map. | Such an enum is stored as JSON, so @@rent.native, @@map and @@schema do not apply. Give the variant field no default. |
RSL243 | The schema declares a generator block, which Rent does not read. | Remove it. Configure generated code in rent.toml under [generate]. |
RSL244 | A relation declared foreignKey: false is required, sits on the side without fields, takes onDelete, onUpdate or map, or passes a value other than false. | Make the relation field optional, move it to the side that declares fields, and drop the referential actions and constraint name. |
RSL245 | A foreign-key delete subset has invalid fields, arguments, action, or backend. | Use onDelete: SetNull(fields: [nullable_local_field]) or SetDefault(fields: [local_field]) with a nonempty, unique local FK subset on PostgreSQL 15+. |
RSL246 | A unique's mode is neither insensitive nor default, or a mode: insensitive unique names no text field. | Use mode: insensitive on a unique over at least one String field, or drop the mode. |
Example
rent/schema.rsl:8:16 [RSL217] unknown `reference` argument for `@relation`The location points at the invalid argument. In this case, rename reference to references, then run:
rent validate
rent format --check
rent generatePermissions
These diagnostics apply to the optional permissions language.
| Code | Meaning | Fix |
|---|---|---|
RSL247 | More than one access block. | Keep one schema-wide access block. |
RSL248 | Missing or invalid subjects. | Name at least one ordinary model, such as subjects = [User]. |
RSL249 | Unknown permissions model. | Use a declared model name. |
RSL250 | Permission declarations without access. | Add an access block, or remove the permission declarations. |
RSL251 | Unknown relationship or named permission. | Use a declared relationship or named rule on the current model. |
RSL252 | Invalid permission condition. | Use an existing field and compatible scalar values. Timestamps must include an offset. |
RSL253 | A path ends at a non-subject. | Name its subject relationship or a named permission. |
RSL254 | A path has ambiguous subject relationships. | Name the intended subject hop explicitly. |
RSL255 | A rule cycle does not cross a relationship. | Break the local alias cycle. |
RSL256 | An ordinary model has no permissions block. | Declare its operations, or mark a genuinely system-only model @@rent.system. |
RSL257 | A required CRUD operation is missing. | Declare it explicitly, using nobody to deny it. |
RSL271 | A permission profile definition or use is duplicated. | Keep one definition and use each profile once per block. |
RSL272 | A referenced permission profile does not exist. | Define it in the same schema file or directory and check its name. |
RSL273 | Permission profiles form a composition cycle. | Remove the cyclic use. Recursive data relationships are separate. |
RSL274 | Profile expansion exceeds 64 levels or 4,096 rule assignments. | Flatten composition or split policies into smaller model-specific definitions. |
RSL258 | A permission name is duplicate, reserved, or ambiguous. | Use a unique snake_case name distinct from fields and relationships. |
RSL259 | Create depends on evidence belonging to a nonexistent row. | Start from an owned to-one parent or the creating subject. |
RSL260 | Invalid expiry annotation. | Use at most one DateTime field per model. |
RSL261 | Invalid creator annotation or key. | Use a required owned subject relationship referencing the complete primary key. |
RSL262 | Repeated exclusion at the same level. | Use one but not per level, with parentheses for nesting. |
RSL263 | Invalid configured depth. | Use an integer between 1 and 64. |
RSL264 | A permission declaration crosses a system-model boundary. | Keep system models outside ordinary permission graphs. |
RSL265 | Invalid direct grants or missing grant authority. | Declare grants on named rules, use valid subjects/usersets, and declare manage_grants. |
RSL266 | A negative dependency cycle. | Remove recursive exclusion. Recursive dependencies must be positive. |
RSL267 | Unsupported permission identity. | Use non-null integer, String, or UUID primary-key components. |
RSL268 | Expression nesting or operator limit exceeded. | Split long expressions into named rules. Nesting is limited to 64. |
RSL269 | Duplicate permissions blocks for one model. | Combine the rules in one block. |
RSL270 | Invalid permission expression or configuration. | Follow the attached detail for grouping, delegation, or references. |
Model mixins
| Code | Meaning | Fix |
|---|---|---|
RSL280 | Duplicate mixin name or name shared with a model/type. | Keep one unique name across the schema directory. |
RSL281 | Unknown mixin in use. | Declare the mixin and check its name. |
RSL282 | Cyclic mixin composition. | Remove the cyclic use. |
RSL283 | Expansion exceeds 64 levels or 4,096 fields. | Flatten or split the declarations. |
RSL284 | A field or singleton model attribute is declared twice. | Remove the duplicate. Mixins do not silently override fields or attributes. |
RSL285 | A mixin is applied outside a model or mixin. | Keep use out of views and composite value types. |
Other field, relation, tenant and permission diagnostics still apply after expansion. An invalid inherited declaration points to its original mixin file.
