Skip to content

Diagnostics Reference ​

Every warning Rivet writes to stderr, and every error it stops on except a command-line usage error, carries a stable ID in a canonical, machine-parseable format:

warning RIV1003: <message>
error RIV2002: <message>

IDs are stable across releases — grep, baseline, or suppress by ID, never by message text. A warning lets processing carry on; an Error is fatal and exits 1. There are twice as many errors as warnings these days, because most of what used to be a warning about a wrong spec now refuses to write one. The errors are RIV1001, RIV1002, RIV1004, RIV1006, RIV1007, RIV1010, RIV1014, RIV1015, RIV1016, RIV1017, RIV1018, RIV1019, RIV1020, RIV1021, RIV1022, RIV1023, RIV1100, RIV1102, RIV1103, RIV1104, RIV1106, RIV1107, RIV1108, RIV1109, RIV1110, RIV1111, RIV1112, RIV1113, RIV1114, RIV1115, RIV1116, RIV1117, RIV1118, RIV1119, RIV1120, RIV1121, RIV1122, RIV1123, RIV1124, RIV1125, RIV1126, RIV2001, RIV2002, RIV2005, RIV2006, RIV2007, RIV2008, RIV2009, RIV2010, RIV2011, RIV2012, RIV2013, RIV2015, RIV2016, RIV2017, RIV2018, RIV2020, RIV2021, RIV3032, RIV4005, RIV4006, RIV4008, RIV4009. Coverage warnings also exit 1 whenever --check is used, with or without --output; other warnings do not change the exit code.

The ID ranges follow the pipeline stages:

RangeStage
RIV1xxxExtraction (Roslyn walkers)
RIV2xxxEmission (OpenAPI emitter, contract JSON reader)
RIV3xxxImport (--from-openapi scaffold)
RIV4xxxCoverage (--check)

Within the extraction range, RIV1024-RIV1099 were once reserved for the rivet/php sibling runtime, which has since been dropped. The block stays empty and is never reused.

Markers are not diagnostics. The // [rivet:unsupported …] marker comments that --from-openapi writes into scaffolded source are part of the generated code, not stderr diagnostics — they have their own grammar and carry no RIV ID. See the Import Profile marker table.

The registry (Rivet.Tool/Diagnostics.cs) and this page are cross-checked in both directions by the test suite (DiagnosticsTests) — every registered ID must have a row here with the same severity, and every row here must be a registered ID.

RIV1xxx — extraction ​

IDSeverityTriggerRemediation
RIV1001ErrorContract endpoint field is not static readonly. Rivet reads the spec from the field's initializer, so a field that can be reassigned, or exists once per instance, could serve a different definition at runtime than the one in the spec.Declare the Define field as public static readonly.
RIV1002ErrorResponse example targets a status code the contract endpoint does not declare — the spec has no response to put it on, so generation fails rather than quietly losing it. Also raised when an example names a media type its .ResponseContent(...) status doesn't declare, or names none when that status declares several. An example without a media type takes the status's own (or the success body's .ProducesContentType(...)).Declare the status on the endpoint (.Returns(...), .Status(...) or .ResponseContent(...)) or fix the example's status code.
RIV1003Warning[JsonPropertyName] on a route-bound property is ignored for route interpolation — the contract param keeps the route name.Align the route token and the property name, or accept that the route name wins for path params.
RIV1004ErrorResponse example targets a status code the controller endpoint does not declare — the spec has no response to put it on, so generation fails rather than quietly losing it.Declare the response status on the action (e.g. [ProducesResponseType]) or fix the example's status code.
RIV1006ErrorUnmapped typed result branch in Results<...>, or an action with no declared success response — generation fails instead of guessing or omitting the response.Declare the branch with a fixed-status typed result or explicit [ProducesResponseType]; declare the success response with [ProducesResponseType(typeof(T), 200)], a concrete payload return, or a fixed-status typed result.
RIV1007ErrorTwo walked types share a simple name: different namespaces, nesting, or generic arity (Result and Result<T>). Schema names are global and built from the simple name alone, so generation fails and names both types. A walked type that takes the name of a [RivetGeneratedSchema] component is the same collision: the type would replace the generated schema. Only the enum or [RivetScalar] brand the schema annotates may share its name.Rename one of the two types. If the other is a generated schema, rename your type or re-import.
RIV1008WarningA [Range] bound could not be parsed — the range constraint is skipped.Use numeric [Range] bounds the walker can evaluate.
RIV1010ErrorBigInteger has no System.Text.Json converter: it serializes as an object of its IsZero/Sign/… properties and can't be read back, so no schema describes it honestly.Expose the value as a string of digits, or as long or decimal when the range allows.
RIV1013WarningDictionary key type has no contract representation (supported: string, enums, string-backed brands, string-serializable primitives like Guid/DateTime/char/numerics) — keys are emitted as unconstrained strings.Use a supported key type, or accept the unconstrained string keys.
RIV1014ErrorA [JsonDerivedType] registration a string-discriminated oneOf can't represent. An int tag isn't a string, a tagless registration writes no discriminator at all, and a registered type that isn't a named class, struct or record (typeof(int[]) compiles, sadly) has no variant schema to point at; System.Text.Json throws on that last one anyway.Register only types that derive from the base, each with a string tag: [JsonDerivedType(typeof(Circle), "circle")].
RIV1015Error[JsonPolymorphic] base type has no [JsonDerivedType] registrations. System.Text.Json doesn't shrug and write the base: it throws ("should specify at least one derived type") the moment it meets the type, so no host can serve it and there's no honest schema to write.Register the derived types with [JsonDerivedType(typeof(Derived), "tag")], or remove [JsonPolymorphic].
RIV1016Error[JsonPolymorphic] sets UnknownDerivedTypeHandling to FallBackToBaseType or FallBackToNearestAncestor. The host then writes a derived type it never registered as its base (or nearest registered ancestor), and the spec's oneOf admits only the registered types, so the document would reject a payload the server actually sends. Generation stops rather than publish that. Setting it to FailSerialization, the default, is fine. IgnoreUnrecognizedTypeDiscriminators = true is refused for the same reason in the other direction: the host reads a body with an unknown tag as the base, which the oneOf rejects.Remove the setting, so an unregistered type fails to serialize and an unknown tag fails to read, as System.Text.Json does by default, and register every type the API really sends or accepts with [JsonDerivedType].
RIV1017Error.WithResponseHeader() targets a status code the contract endpoint does not declare — the spec has no response to put it on, so generation fails rather than leaving out a header the handler sends.Declare the status on the endpoint (.Returns(...), .Status(...) or .ResponseContent(...)) or fix the header's status code.
RIV1018Error[RivetUnion] wrapper has no variant properties, so there is no union to emit.Give the wrapper one optional property per variant (the shape the importer generates), or remove the attribute.
RIV1019ErrorRoute token has no typed declaration: no matching property on the endpoint's input type (after normalized matching: case-insensitive, _/- stripped), no .Parameter<T>(name, "path", ...), no type constraint, or, on a [RivetEndpoint] action, no action parameter. Its type is unknown, and the spec would have to guess string, looser than whatever the handler binds, so generation fails instead.Add a matching property to the input type, a type constraint to the route ({id:guid}, {id:int}), or a .Parameter<T>(name, "path", ...) declaration.
RIV1020ErrorThe input type on a request with no JSON body (GET, DELETE, .AcceptsBinary()) is a dictionary, collection or scalar. Such an input must lower to route and query params, and this one has no properties to lower, so generation fails instead of emitting an operation without it.Model the input as a record with one property per route or query param, or send the values as a JSON body with Define.Post/Put/Patch.
RIV1021ErrorAn authored contract declares the same response status more than once, including a .Returns(...) collision with the success status. Such a contract fails at runtime and generation therefore aborts.Declare a [RivetUnion] type if the status genuinely returns multiple shapes and return it once; otherwise remove the duplicate (often one .Returns(...) is mistyped).
RIV1022Error[RivetRequestBody] names a body type that is not represented independently by the endpoint input type, or one that carries files (an IFormFile or a list of them) while the input type carries none the form binders bind: a file nested in one of the input's members, or one without a public getter, doesn't make the body multipart. The input type alone makes a body multipart, as the runtime decides it, so the declared type can't add a file.Declare the type of one of the input's non-route members, or a type whose every member the input declares under the same JSON name, type, and optionality, or remove the attribute. Put the file on the input type as one of its own members, with a public getter.
RIV1023ErrorImported generated C# changed while raw schema provenance still targets its original typed shape.Re-import the OpenAPI document, or remove/update the stale raw schema provenance before emitting.
RIV1100ErrorA parameter's binding source cannot be established from explicit declarations or the retained narrow conventions (exact route-token name match, CancellationToken, IFormFile) — the contract is refused rather than emitting an operation that silently omits the input. Also raised, instead of the operation vanishing, when a [RivetEndpoint] method or an abstract method on a [RivetContract] class has no HTTP verb, or when one of those or a [RivetClient] endpoint has no route template on the action or its class. (A [RivetClient] method with no verb is a helper and is left alone.) And when a form input's member is read under different names by the hosts that can serve it (a contract's [FromForm(Name = ...)] that the minimal-API form mapper ignores, or a [DataMember(Name = ...)] that MVC ignores), or from somewhere other than the form (a [FromQuery] or [FromHeader] on the member), so no one part name in the spec reaches every host. So is a form member only one host skips (for MVC a [BindNever] or [BindingBehavior(BindingBehavior.Never)] on the member or its class, or a class-level [Bind("A", "B")] include list that leaves it out, a positional record's constructor parameter included; for the form mapper [IgnoreDataMember]), a form input a host can't create (MVC needs a record's one exactly matching constructor or a public parameterless one, so it can't create an abstract class, a struct, or a record struct; the form mapper binds nothing on an abstract type or on one with more than one public constructor), and a file member nothing can set, which would make the body multipart for a part no binder reads. A get-only file collection (List<IFormFile> Files { get; } = [];) is a part on an MVC action, since MVC fills the list the getter returns, but only when its initializer creates a writable collection. One left null, computed on each read, or started as a read-only collection is a file nothing can set. On a contract even the live one is refused, because the form mapper can't set it.Give the parameter an explicit binding ([FromBody], [FromQuery], [FromRoute], [FromHeader], [FromForm], or [FromServices] for DI plumbing), or remove it from the action. For a missing verb or route, add the [Http*] attribute and a route template, or remove the method. For a form member, rename it for both binders with the same name ([DataMember(Name = "x")] and [FromForm(Name = "x")], the latter on a positional record's parameter), or drop the rename or the binding attribute. Skip a member for both hosts or neither, make a form input a class with one public constructor (a parameterless one, or a positional record's), and give a file member, a contract's file collection included, a public setter or init.
RIV1102ErrorA response example or response content is authored on a body-forbidden status (1xx, 204, 205, 304) — HTTP forbids a message body on those statuses, so the authored content could never reach the wire. Reported at frontend parsing and again at emission as defense in depth; generation fails before any output is written.Move the example/content to a status that allows a body, or remove it; the ordinary bodyless 204 response needs no example.
RIV1103ErrorA [RivetScalar] type is not a non-generic class/struct/record with one public readable Value property and a matching public constructor, without inheritance, competing converters or property-level JSON settings.Give the type exactly one Value property (the Value type determines the scalar wire type), or remove [RivetScalar] if the type is an ordinary object.
RIV1104ErrorAn endpoint mixes separate form fields or files with an explicit body parameter — a [FromBody] JSON body or a [FromForm] DTO whose recursive form shape Rivet cannot faithfully lower without emulating MVC's recursive form binder — the contract is refused instead of silently dropping the declared input. A contract that combines .AcceptsBinary() with .AcceptsFile() or .FormEncoded() is the same mix: a request body is raw bytes or a form, never both, and the runtime builder refuses it too.Split the form DTO into scalar fields (each scalar emits a form part beside the file), move a [FromBody] body to a separate JSON endpoint, or accept the file-only surface. For a contract, keep one of .AcceptsBinary() and the form call.
RIV1106ErrorTwo enum members produce the same wire value (via the declared converter's casing or duplicate [JsonStringEnumMemberName] pins) — generation fails instead of emitting an incorrect numeric schema.Rename one of the colliding members (or fix its [JsonStringEnumMemberName]) so the wire values are distinct.
RIV1107ErrorAn endpoint declares the same response status twice with different bodies — a [ProducesResponseType]/.Returns(...) declaration and a mapped Results<> branch disagree on the payload type, or one declares a body where the other declares none. One status carries exactly one shape; generation fails instead of silently letting the attribute win.Align the attribute declaration and the Results<> branch (same payload type, or both bodyless), or drop the redundant declaration.
RIV1108ErrorUnsupported enum converter, wrong generic enum target, or string flags/aliases.Use a built-in or Rivet enum converter with distinct values; use numeric serialization for flags.
RIV1109ErrorA contract endpoint declares the same response header more than once for one status. Header names are case-insensitive, so .WithResponseHeader("ETag").WithResponseHeader("etag") is a duplicate; generation fails instead of emitting both spellings.Keep one .WithResponseHeader(...) per header name and status.
RIV1110ErrorA [RivetEndpoint] or [RivetClient] action binds a string-wire enum (a Rivet*EnumConverter or a [JsonStringEnumMemberName] rename) from route, query, header or form, directly or inside a complex parameter the host binds member by member, and the host would refuse a value the spec advertises. ASP.NET parses these itself and never asks the JSON converter: an MVC action needs each wire value to equal its member name ignoring case, a static [RivetEndpoint] (a minimal-API handler) needs it exactly. Which parameters count, host by host, is in Limitations.Use a plain enum, the built-in JsonStringEnumConverter<T> without renames, or bind a string and parse it yourself. On MVC, camelCase and lowercase converters also bind, and an explicit [ModelBinder] exempts the parameter.
RIV1111ErrorA [JsonConverter] Rivet can't model sits on a walked type, property or field: anything but a supported converter on the enum type, [RivetScalar] or [RivetUnion]. The wire is whatever the converter writes, so the spec would describe the CLR shape instead.On a primitive-typed property, pin the wire with [RivetSchemaType("string")] (or whichever JSON type the converter writes). Otherwise make the value a [RivetScalar] wrapper, or put a supported converter on the enum type itself.
RIV1112Error[JsonNumberHandling] with WriteAsString or AllowNamedFloatingPointLiterals reaches a number, or a collection of numbers, on a walked type, from the member or from the type being serialized. That includes Int128, UInt128 and Half. A generic's T member is judged per instantiation: Wrapper<int> is refused, Wrapper<string> is fine. Strings go on the wire where the spec says number. AllowReadingFromString alone is accepted: numbers are still written as numbers, it only widens what the host reads.Remove it, pin a primitive-typed property with [RivetSchemaType("string")], or instantiate the generic with a non-number type argument.
RIV1113ErrorRivet reads a contract endpoint from source and can't read this one: the field has no initializer, or its initializer isn't a Define.* builder chain (a helper call or another field, say); the endpoint is a property rather than a field; the chain calls something that isn't a Rivet builder method; an example has nothing in it; or a route is null; or a builder call is given a string, int or bool that isn't a compile-time constant. That last one covers every such argument, not just the route: .Summary(text), .Status(code), .ProducesFile(type), .QueryAuth(name), a scheme name, a scope. Rivet can't tell a variable from an omitted argument, so it used to skip the field or quietly fall back to the default.Declare the endpoint as a public static readonly field initialised with Define.* and Rivet builder calls only, and pass every argument as a literal or a const (const strings can be concatenated or interpolated).
RIV1114ErrorA contract endpoint's security calls contradict each other: .Anonymous() (no security requirement at all) sits alongside .Secure() or .OrAnonymous(), or .AndSecure() has no .Secure() alternative to join (it comes first, or straight after .OrAnonymous()). The same goes for [RivetSecure], [RivetAndSecure], [RivetOrAnonymous], and [RivetAnonymous] on a controller or action, where [RivetAndSecure] joins the [RivetSecure] written before it in source order, and so may not be split across partial declarations in different files. Rivet refuses rather than guessing which call you meant.Use .Anonymous() (or [RivetAnonymous]) alone for an open endpoint, .Secure(...) plus .OrAnonymous() for optional credentials, and start every AND-group with .Secure(...). Keep a level's security attributes in one file.
RIV1115ErrorMVC binding setup that can't be read statically, which decides what MVC binds, so RIV1100, RIV1110, RIV4005 and RIV4006 would be answering on a guess; generation and --check stop instead, naming the file and line. Three shapes: something in the app assigns ApiBehaviorOptions.SuppressInferBindingSourcesForParameters a value that isn't a compile-time constant (a config read, a variable, a compound assignment), read only when an annotated MVC action (generation) or a contract's MVC implementation (--check) is on an [ApiController] controller; a property filter (an IPropertyFilterProvider) other than [Bind]'s include list on an MVC parameter, the type it binds member by member, a nested member, or a contract's form input type, since MVC runs its code to pick the members it binds; and a BindingBehaviorAttribute subclass other than [BindNever] and [BindRequired], whose behaviour its own constructor sets. A minimal-API-only check never reads the last two, since the form mapper ignores both.Assign the constant true or false (a const bool works too). Name the members with [Bind("A", "B")], or skip one with [BindNever] or [BindingBehavior(BindingBehavior.Never)].
RIV1116ErrorA walked type has more than one [JsonConstructor] constructor. System.Text.Json refuses such a type at runtime, so there's no constructor whose parameters the spec could follow.Keep [JsonConstructor] on one constructor.
RIV1117Error[RivetSchemaType] sits on a member whose type isn't a primitive or a nullable primitive. The attribute re-types a primitive leaf and nothing else, so on an object, a collection or a named type it would vanish without a trace, and the spec would go on describing the CLR shape you were trying to override. The message names the member. The same goes for .WithResponseHeader<T>(schemaType: ...) on a T that isn't a primitive.When the type is a string (or another scalar) on the wire, say so on the type with [RivetScalar]. On a [RivetScalar] brand, which already is one, change the type of its Value property instead (a [RivetFormat] on the brand sets its format). Otherwise remove the attribute. For a response header, drop schemaType:.
RIV1118ErrorA [JsonExtensionData] member System.Text.Json won't accept: anything but a JsonObject or a type implementing IDictionary<string, JsonElement> or IDictionary<string, object> (Dictionary, SortedDictionary, ConcurrentDictionary and friends), or a second bag on the type or anywhere down its base chain. Also raised when the bag sits on a type marked [JsonUnmappedMemberHandling(JsonUnmappedMemberHandling.Disallow)]: one says "keep the unknown members", the other "refuse them", and STJ throws at runtime rather than pick.Type the bag as one STJ accepts, keep one bag, or drop either the bag or the Disallow.
RIV1119ErrorA member is [JsonRequired] (or C# required) and may also be left out when written: it's [RivetOptional], or [JsonIgnore(Condition = WhenWritingNull)]/WhenWritingDefault. Reading demands the member while writing may omit it, and one schema can't say both, so generation stops and names the member.Drop the requirement if the member really is optional, or drop the attribute that lets it be omitted.
RIV1120ErrorA response status OpenAPI can't key a response by: a string key that isn't a status code, a 1XX-5XX range, or default (in any casing, which is emitted as default), or an int status outside 100 to 599. Left alone it would reach the spec as written, where no client can match it, and the runtime refuses the same keys at startup, on every status-taking call.Use a status code ("404" or 404), a range ("4XX"), or "default" in .StatusKey(...), .Returns(...), .ResponseContent(...), and the other status-taking calls, or a code from 100 to 599 in [ProducesResponseType].
RIV1121ErrorAn [assembly: RivetSecurityScheme(...)] or [assembly: RivetOAuthFlow(...)] describes a scheme that can't exist. That's the same scheme name declared twice; a type other than apiKey, http, oauth2, openIdConnect, or mutualTLS; an apiKey location other than query, header, or cookie; an OAuth2 flow other than implicit, password, clientCredentials, or authorizationCode; a scheme missing its type or the field its type needs (an apiKey's name and location, an HTTP scheme, an OpenID Connect URL); a flow whose scope names and descriptions don't pair up; a flow or scope declared twice; or a null scope. A [RivetOAuthFlow] whose scheme isn't a declared oauth2 one is an error too, as is a [RivetGlobalSecurityScheme] whose order no [RivetGlobalSecurity] starts. So is any [RivetSecurityScheme], [RivetOAuthFlow], [RivetGlobalSecurity], or [RivetGlobalSecurityScheme] whose arguments Rivet can't read at all (a null name, flow, or scope list, or arguments from another Rivet.Attributes version). Each of these used to drop out of the spec without a word, or crash. Generation stops rather than guess what the scheme was meant to be.Fix the attribute's arguments: declare each scheme, flow, and scope once, give each flow an oauth2 scheme, and start every alternative you add a scheme to with [RivetGlobalSecurity]. Use the same version of Rivet.Attributes and the tool. Attributes: Security has the shapes.
RIV1122ErrorGenerated metadata Rivet reads back is malformed, which almost always means generated code that went stale or got hand-edited. Today that's a [RivetGeneratedType] whose DiscriminatorSchemaJson isn't valid JSON or a JSON object, whose enum, const or type can't carry the tag the variant is registered with, or that sits on a type no base registers with [JsonDerivedType], where there's no tag property for it to describe at all. Emitting any of those would publish a spec that refuses, or never mentions, the very tag System.Text.Json writes, so generation stops and names the type. Or it's a [RivetGeneratedSchema] enum entry (isEnum) whose name no enum in the compilation has, so its metadata has no enum schema to join. The same ID covers every other attribute import writes and generation reads back: a [RivetGeneratedSchema] or [RivetGeneratedSchemaMetadata] with missing or mistyped arguments, unparseable metadata JSON, a name another generated schema already has, or a $ref to a generated schema that doesn't exist; an OpenAPI provenance attribute ([RivetDocumentInfo] twice, a [RivetPreservedField] naming something other than an x- extension or a documentation field, a [RivetOperationProvenance] schema that isn't a JSON object, and the rest of the family) that doesn't read, or one with a different number of arguments than the tool reads, which means the project's Rivet.Attributes and the rivet tool are different versions; and a synthetic type that references itself, which can't be inlined.Re-import the OpenAPI document. If you edited the JSON on purpose, make it a schema object that admits the tag: {"type":"string"}, or an enum that lists it. If the type isn't a registered variant, remove DiscriminatorSchemaJson. A stray enum entry: re-import, or delete the attribute. An argument-count mismatch: use the same version of Rivet.Attributes and the tool, then re-import.
RIV1123ErrorAn authored value isn't the shape its slot needs. A builder argument's JSON (metadataJson, exampleJson, examplesJson, schemaExamplesJson, referencedComponentsJson and the like, as import writes them), a [RivetDefault] or [RivetExample] value, or a JSON value in schema metadata doesn't parse, or isn't the kind its keyword takes: examples on a schema is an array, examples on a parameter or header is an object of Example Objects. Or .Parameter<T>(name, location, ...) names a location other than path, query, header, or cookie, or a path parameter whose name matches its route token only ignoring case (an OpenAPI path parameter is matched to its token by its exact name). Written as-is, any of these would make an invalid spec, so generation stops and names the argument.Fix the value: valid JSON of the kind the message names (a JSON string keeps its quotes), or one of the four locations, or the token's exact spelling. If import wrote it, re-import.
RIV1124ErrorAn Azure Functions project's host.json can't be read, isn't JSON, or gives extensions.http.routePrefix as something other than a string. --check needs the prefix to compare a function's route with its contract's, and assuming the default api would compare against a prefix the host doesn't use.Fix host.json so the prefix is a string ("" for none), or set AzureFunctionsJobHost__extensions__http__routePrefix, which wins over the file.
RIV1125ErrorA route constraint can't hold with what declares its token (the input property, a .Parameter<T>(name, "path", ...), or a [RivetEndpoint] action parameter). That covers: a type constraint that disagrees with the type ({id:int} over a string Id); a keyword the type can't carry (min/max/range on a non-integer, length/minlength/maxlength/alpha/regex on a non-string); two type constraints; two patterns (with [RegularExpression] or each other); bounds that, intersected with the member's own, admit no value; a malformed constraint argument (a regex with no pattern among them); and a template routing refuses at startup ({a}{b}, {id?=5}, an unclosed {, and, on a controller action, a [RivetEndpoint] method, or an abstract contract's method, a parameter name used twice; a static contract's field, the shape import writes, still reads a repeat, as an imported path can carry one, until import's handling of it is decided). So is a literal brace in the path (/a/{{x}}, which routing serves as /a/{x}): OpenAPI path templating has no escape for a brace, so the spec can't hold the path. Routing then admits one thing and the handler binds another, and the spec can only describe one of them. Also raised for an attribute route MVC refuses at startup: a [token] nothing supplies a value for ([area] with no [Area], or a typo), an unclosed [, or two route value attributes keying one value on the same action or controller; and for a token only a route value attribute Rivet can't follow to constant arguments could supply.Make the constraint and the property agree: change the property's type, or the constraint (or drop it and let the property type the parameter), or drop one of the two patterns. A template routing or MVC refuses needs fixing whatever declares its tokens, a route value attribute Rivet can't read needs constant constructor arguments (or the segment written into the template), and a literal brace has to come out of the path.
RIV1126ErrorThe C# can't be read, so there's nothing to generate, check, or list routes from. No MSBuild instance can be found to load the --project (Rivet looks for the .NET SDK under DOTNET_ROOT and the usual install folders), MSBuild can't open the --project file as a C# project (a .sln, an .fsproj, or a stray file), the project yields no compilation, or the project or source files don't compile. A compile failure lists the first ten compiler errors under the line; any workspace failure MSBuild reported while loading the project is printed above it, and is usually why.Install the .NET SDK or point DOTNET_ROOT at it, point --project at the .csproj, or fix the compiler errors (dotnet build shows the same ones).

RIV1024-RIV1099 were once reserved for the dropped rivet/php runtime. Nothing registers them, and nothing ever will.

RIV2xxx — emission ​

IDSeverityTriggerRemediation
RIV2001ErrorA tagged-union variant whose producer pinned its component id (metadata.componentId) lands on an id another schema already uses with a different shape. Unpinned variants never get here: a taken {Base}_{Tag} name picks up a numeric suffix, so each variant always $refs its own schema.Give the variant's componentId a name of its own, or make the variant a ref to the existing type.
RIV2002ErrorA document or endpoint security requirement names a scheme with no definition; generation fails rather than inventing security semantics.Define the scheme via --security or [assembly: RivetSecurityScheme(...)], or fix the .Secure("...")/.AndSecure("...") name.
RIV2003WarningTwo endpoints share an HTTP method + path and their declarations are equivalent — one representative is emitted.Remove or re-route the redundant duplicate endpoint.
RIV2005ErrorA type with no schema mapping (an unknown primitive whose csharpType isn't one of the "any JSON" types below), or a $ref to a schema component nothing defines. The message names the type and its site, or the dangling component and where it's referenced. The check reads the finished document; a "$ref" key inside an example's value, a link's requestBody or parameters, or a default, const, enum or x- extension is data, not a reference. "Any JSON value" is not this: TypeScript's unknown, object, JsonElement, JsonDocument and the JsonNode family (JsonNode, JsonObject, JsonArray, JsonValue) map to the empty schema {} with no diagnostic at all. (A C# JsonObject or JsonArray property is an object or array, as Type Mapping says; the empty schema is for contract JSON naming one as an unknown's csharpType.)Replace the named type with a supported one (or JsonElement/object if it really is any JSON); for a dangling $ref, ship the missing definition in the contract's types.
RIV2006ErrorA generic type parameter reaches the schema unbound, so there's nothing to emit for it, or an instantiation's type-argument count doesn't match its template's.Use a closed generic (Wrapper<OrderDto>, not Wrapper<T>), and give every instantiation one type argument per template parameter.
RIV2007ErrorA generic instantiation's template is absent from the contract's type definitions.Ship the template (with its typeParameters) in the contract's types.
RIV2008ErrorContract JSON declares one brand name two different ways; the message shows both declarations.Declare every use of the brand identically, or give the second shape a brand name of its own.
RIV2009ErrorHeader parameter named Accept, Content-Type or Authorization — OpenAPI ignores these as header parameters, so the spec would never carry it and clients would never send what the handler reads; generation fails. A response header named Content-Type is refused for the same reason: OpenAPI says such a header "SHALL be ignored", so the runtime would demand a header the spec never mentions.Describe content negotiation with .ProducesContentType(...)/.AcceptsContentType(...) (a response's media type is .ProducesContentType(...), never a response header) and auth with a security scheme (.Secure(...) or --security); use a custom header name for anything else.
RIV2010ErrorController metadata (a repeated [ProducesResponseType] status) or contract JSON declares the same response status more than once.Declare each status once; when one status genuinely has several payload shapes, declare one union type ([RivetUnion] in C#) and use that.
RIV2011ErrorTwo --security values define the same scheme name.Give each --security scheme a unique name (name=<value>).
RIV2012ErrorTwo incompatible endpoints declare the same normalized HTTP method + route (e.g. contradictory response shapes from different extraction frontends) — generation fails naming both sources instead of writing a lossy spec.Resolve the contradiction at the source. Equivalent duplicates collapse silently when contracts from several frontends are merged; within one contract or a --from document they still warn with RIV2003.
RIV2013ErrorTwo routes differ only in their parameter names (/items/{id} and /items/{itemId}). OpenAPI identifies a path by its template with the names erased, so they're one path, and writing both makes an invalid document. Generation fails naming both.Use the same parameter names on every route with that template.
RIV2015ErrorTwo examples pin the same component example id with different values, or one states a summary or description that contradicts the other's. One components.examples entry holds one example, so the second endpoint's $ref would quietly point at the first one's. Equal values (compared as JSON, not text) share the component, and it carries the summary and description whichever example states them. An imported components.examples entry counts as the first pin.Give one of the examples its own component id, or make the two the same.
RIV2016ErrorA [RivetPreservedField] can't attach to the emitted document: its owner pointer names nothing the C# emits any more (an operation or schema was renamed or removed since import), or the owner now carries that field itself. Dropping it would lose what the source said, and overwriting would discard what the C# says, so generation stops and names the field and pointer.Re-import the OpenAPI document. If you changed the C# on purpose, remove the [RivetPreservedField] (or point it at the new owner).
RIV2017Error--from contract JSON doesn't read: it isn't JSON, or it isn't the contract schema's shape (a missing required property, an unknown one, a value of the wrong type). Or it says something the IR can't hold, even though every property in it is one the schema knows. A tagged-union variant's discriminatorSchema isn't a JSON object, or its enum, const or type can't carry the variant's tag; or a variant carries a description, scalarMetadata or discriminatorSchema but isn't an inline object with the tag property, so there's nowhere to put them. Or a routeTemplate token carries ASP.NET routing syntax ({id:int}, {id?}, {page=1}, {*path}): the template is the OpenAPI path key as written, so the token would match no parameter. Or the routeTemplate is one routing can't read at all ({a}{b}, an unclosed {), or carries a literal brace ({{ or }}), which an OpenAPI path key can't hold. Or a response's statusCode is outside 100 to 599, or its statusKey isn't a status code, a 1XX-5XX range, or lowercase default. Or a formField param's style is one a form part can't take: its style goes in the form body's encoding, which holds form, spaceDelimited, pipeDelimited, or deepObject, not matrix, label, or simple. The reader stops before anything is emitted.Fix the producer: emit JSON that validates against rivet-contract-schema.json, write the tag schema as a JSON object that admits the tag, and put variant annotations only on an inline-object variant whose properties include the discriminator. Write route tokens bare ({id}) and type them with their path param, in a template routing can read. Key each response by a statusCode from 100 to 599 or a statusKey OpenAPI can hold. Give a form field one of the four form styles, or none.
RIV2018ErrorA --security value isn't a scheme Rivet can define. The shapes are bearer[:format], cookie:name, apikey:location:name (query, header, or cookie), and name= before any of them to name the scheme yourself. With --from-openapi, --security is something else: the one scheme name the imported operations that declare no security are given, so a scheme definition, or a second --security, is refused too.Use one of those shapes, or declare the scheme in source with [assembly: RivetSecurityScheme(...)]. With --from-openapi, pass one scheme name the document defines.
RIV2019WarningA --from contract's form field states something its form part can't carry. A form part is a property of the body's schema, which holds example values but not Example Objects, so an example's summary, description, or externalValue is dropped (its value still joins the field's examples), and so is an example with no value at all (only an externalValue or a $ref). A field that states examples has its own part schema for them to join, so its body is spelled out rather than a $ref to the input record. And allowEmptyValue exists only on query parameters. The warning names the field and everything dropped; the field's style, explode, and allowReserved still reach the body's encoding.Put the example's value in examples with nothing beside it, and the rest in the field's description if it matters. Leave allowEmptyValue off form fields.
RIV2020Error--verify found the committed spec out of date: the file it compares against (--openapi, else openapi.json under --output) doesn't exist, or differs from the spec the input produces now, byte for byte. Emission is deterministic, so any difference means the source and the spec have drifted. Nothing is written.Run the same command without --verify to regenerate the spec, and commit it.
RIV2021ErrorAn input path doesn't exist: the --from contract JSON, the --from-openapi document, a source file (or a file in a folder you passed), or the --project file. The message names the flag (or says it's a source file) and the path, and nothing is read or written.Fix the path. Relative paths are read from the directory you run Rivet in.

RIV3xxx — import ​

Import warnings are also surfaced programmatically on ImportResult.Warnings, where each entry carries its ID as a RIV3001: prefix. The test-suite ratchet categories these map to are listed in the Import Profile. RIV3032 is the odd one out: an invalid document is an error, so import stops on it instead of collecting it.

IDSeverityTriggerRemediation
RIV3001WarningAlias schema is part of a $ref cycle — replaced with an empty schema; consumers resolve to an untyped object.Break the cycle in the source spec, or type the affected members after scaffolding.
RIV3003WarningTRACE operation dropped — the HTTP method has no contract representation.No action; TRACE is out of scope for the contract model.
RIV3005Warningdiscriminator with no reversible polymorphic shape (a plain object with neither oneOf nor allOf descendants, an allOf hierarchy C#'s single inheritance can't hold, a discriminator beside a component's own allOf, or a oneOf whose mapping is absent/unusable or whose siblings go beyond the discriminator), imported without dispatch semantics. Also a single discriminator.mapping entry that points into another file (models/resize.yml): Rivet imports one document, so that entry is dropped and the rest of the discriminator kept.Model the polymorphism as a oneOf with a complete discriminator.mapping whose variants carry the tag property, or model it as allOf inheritance from a discriminated base, or accept the non-polymorphic import. For a cross-file mapping, bundle the spec into one document first.
RIV3006WarningAlias schema references a missing schema — consumers fall back to JsonElement.Fix the dangling $ref in the source spec, or type the member after scaffolding.
RIV3008WarningReference to an unresolvable alias schema (cycle or missing target) — using JsonElement.Fix the alias it references (see RIV3001/RIV3006).
RIV3009WarningSchema could not be resolved to a C# type — mapped to JsonElement.Type the member by hand in the scaffolded C#.
RIV3010WarningUnhandled JSON Schema type — mapped to JsonElement.Type the member by hand in the scaffolded C#.
RIV3011WarningArray schema without items — mapped to List<JsonElement>.Add items to the source spec, or type the list element after scaffolding.
RIV3014WarningDictionary propertyNames schema has no C# dictionary-key representation — imported with string keys.Reference a string enum / string-backed brand or use a string key schema in the source spec, or type the dictionary key by hand after scaffolding.
RIV3015WarningNamed scalar component uses const, schema composition, or heterogeneous leaf types.Replace it with one primitive leaf (optionally nullable); the existing fallback mapping is retained.
RIV3019WarningA Swagger 2 document gives a host with no schemes, or schemes with no host. Swagger fills the missing half from wherever the document was served, which an import can't know, so Rivet imports no server rather than invent a URL.Give the source both host and schemes, or pass the real server to generation with --server.
RIV3020WarningParameter has an empty name, so the invalid parameter is dropped while the operation and its other parameters are preserved.Give the source parameter a non-empty OpenAPI name.
RIV3021WarningImported operation declares Content-Type as a header parameter even though OpenAPI represents request media types through requestBody.content.Remove the reserved header parameter and retain the corresponding request-body media type.
RIV3022WarningImported operation declares Authorization as a header parameter even though OpenAPI represents authentication through security schemes.Remove the reserved header parameter and retain the corresponding operation or document security requirement.
RIV3023WarningImported operation declares Accept as a header parameter even though OpenAPI represents response media types through response content.Remove the reserved header parameter and retain the corresponding response media type.
RIV3024WarningImported operation authors response content or an example on a body-forbidden status (1xx/204/205/304); the content is dropped while the status, description and headers are preserved.Remove the body from the forbidden status in the source specification — HTTP forbids a message body on 1xx/204/205/304.
RIV3025WarningA parameter declares content instead of a schema (or, outside the path, neither): the parameter is dropped from the operation. A path parameter declared with content drops its whole operation instead, preserved fields and all, whether it sits on the operation, its path item, or a path item it $refs: its route token would be left with nothing to type it, which generation refuses (RIV1019). A path parameter with neither stops import (RIV3032).Give the parameter a schema (a JSON-serialised value is a string parameter), or move the structured value into the request body.
RIV3027WarningOperation or component callbacks entry dropped — contracts describe requests the API receives, not ones it sends.Document the outgoing call in the operation description, or give the receiving service its own contract.
RIV3028Warningwebhooks or components.pathItems entry dropped — only path items under paths become contract endpoints.Give the webhook's receiver its own contract; reference a reusable path item from paths if its operations belong to this API.
RIV3029WarningA path repeats an earlier path's template under other parameter names (/deployments/{idOrUrl} and /deployments/{id}), which OpenAPI forbids. Its operations merge into the earlier path and adopt its path parameter names; requests are unchanged, since path parameter names never reach the wire. Twins that share a method, carry any path-level field on either path, repeat a parameter name, or have an operation that $refs a renamed path parameter are left alone, and generation refuses them with RIV2013.Give every operation on one template the same path parameter names in the source specification.
RIV3030WarningA security alternative names a scheme the document never defines (components.securitySchemes, or Swagger 2's securityDefinitions). Nobody can present that scheme, so the alternative is dropped, which changes nothing about who gets in. When an operation's own security, or the document security it inherits, has no alternative left, nobody can call the operation, so it is dropped too, rather than imported as security: [], which would read as "no credentials needed". An operation that inherits is kept when import --security names a scheme for operations that declare none.Define the scheme under components.securitySchemes, or fix the requirement's name in the source spec.
RIV3031WarningAn integer enum lists a whole value its C# integer type can't hold ([-1, 18446744073709551615] has no CLR integer that fits both, so it stays a long). The values still travel in the generated metadata and re-emit exactly, but C# code reading or writing that type can't carry the values the warning names.Narrow the enum to one integer range in the source spec, give it a format whose type holds every value, or pin a wider type with x-rivet-csharp-type (Int128).
RIV3032ErrorThe --from-openapi document is invalid, so import stops before writing anything: it isn't a JSON object, the OpenAPI reader refuses it, a security scheme has no type (or misses a field its type needs) or a requirement names no scheme, a component example has both value and externalValue (OpenAPI allows one or neither), a local reference targets nothing or loops back on itself, a required field is missing or isn't a string, a path parameter has neither a schema nor content, or an operation's path template has a token no path parameter declares (OpenAPI requires one, in: path and required: true, for every token). The message names what's wrong and where.Fix the source document. For an undeclared token, declare the path parameter on the operation or its path item; for a shapeless one, give it a schema.
RIV3033WarningA schema says additionalProperties: false, which import writes as [JsonUnmappedMemberHandling(Disallow)] so the host refuses an unknown member, but the schema contradicts itself, so its record stays open and accepts and drops one instead. Another record extends it (an allOf hierarchy's base) with members its closure refuses; it is an allOf composition, or a component an allOf composes, where a closed part refuses the members the other parts add; it is a polymorphic variant, whose discriminator System.Text.Json reads as an unknown member when the variant is read on its own (the record leaves the tag to its base); it is a oneOf or anyOf union with a variant that can be an object, whose members come from its variants, which the union's own closure refuses; or it is an instance of a generic template that also serves instances that aren't closed. The warning names the schema, by its component key or, inline, by its pointer, and why. The emitted spec still says additionalProperties: false.Usually nothing: the source is the contradiction. To have the host refuse unknown members, state the closure on the type the request actually binds, or drop additionalProperties: false from the schemas an allOf composes.

RIV4xxx — coverage (--check) ​

IDSeverityTriggerRemediation
RIV4001WarningContract endpoint has no matching implementation.Implement the endpoint, or remove it from the contract.
RIV4002WarningImplementation HTTP method differs from the contract's.Align the implementation's HTTP method with the contract.
RIV4003WarningImplementation route differs from the contract's.Align the implementation's route with the contract.
RIV4004WarningA contract endpoint is bound in a route handler, but the handler neither returns a terminal built from that binding nor passes the binding to a helper whose answer it returns.Return a Success, Error, or File terminal through the correct host adapter, pass the bound endpoint to a helper whose answer the handler returns, or remove the unused Bind.
RIV4005ErrorA handler implementing a contract endpoint binds a string-wire enum (an enum, T? or a collection of either) from route, query, header or form, directly or inside a complex type the host binds member by member, and the host would refuse a value the spec advertises. ASP.NET parses these itself and never asks the JSON converter: a minimal API needs the exact member name, MVC ignores case, and the Azure Functions worker reads a route or query value as JSON, so it takes no name at all. Parameters the host reads as a JSON body, [FromServices] and, on MVC, [ModelBinder] are left alone. Which parameters count, host by host, is in Limitations.Use a plain enum, the built-in JsonStringEnumConverter<T> without renames, or bind a string and parse it yourself. On MVC, camelCase and lowercase converters also bind. On Azure Functions only a plain enum or a string does.
RIV4006ErrorA handler implementing a contract endpoint binds its inputs differently from how the contract declares them: it binds a route value, query parameter, header, form field or body the contract doesn't declare; never binds one the contract declares; or binds one under the declared name from another source. Names compare ignoring case, as ASP.NET's do. Binding follows the host's own inference (minimal API, MVC with and without [ApiController], [AsParameters], Name = and [Bind(Prefix =)] overrides, and a minimal-API [FromForm] record's members by C# name or [DataMember(Name =)]). A .FormEncoded() body is compared field by field under its wire names. A declared cookie is reported unless the handler reads the request, since no attribute binds one. A handler that can read the request itself (an HttpContext/HttpRequest parameter, a BindAsync type, a custom model binder, or a body that reads Request or RouteData however it reaches them, calls GetRouteValue/GetRouteData, or hands the HttpContext or HttpRequest to another method) is never told an input is unbound; reading only User, Response or RequestAborted doesn't count. The Authorization header, a .QueryAuth() token and the header or query parameter of an apiKey scheme in the endpoint's (or the document's global) security, from attributes or --security, belong to security. An Azure Functions handler's unattributed parameters are compared too: the worker fills each by name from a route value, else the query, else a JSON body's top-level property, so one named after no declared route token, query parameter, or body property is reported (it's always null); a body with an extension-data bag takes any name. The trigger is the whole request, so a function is never told an input is unbound. A complex input the host can't create is reported too, whatever else matches. That's an [AsParameters] type ASP.NET refuses when it builds the endpoint (abstract, a constructor parameter no property matches by name and type, or several public constructors and no parameterless one), so the endpoint never serves a request. It's a type MVC binds but can't create (abstract, a struct or record struct with no public parameterless constructor, or a class whose only constructor takes parameters, unless it's a record whose parameters match its properties exactly), so MVC fails the request. And it's a [FromForm] type the minimal-API form mapper binds nothing on (abstract, or more than one public constructor). Its members are still compared as the host would bind them if it could create it.Bind each input where the contract declares it, under its wire name ([FromQuery(Name = "q")] for a [JsonPropertyName("q")] property), or change the contract's input type to say what the handler really takes. For a type the host can't create, make it a class with one public constructor: a parameterless one with settable properties, or a positional record's.
RIV4008ErrorA handler's authorization disagrees with the security its spec declares (a contract field's own; the [RivetSecure]-family attributes on a [RivetEndpoint] or [RivetClient] action, on a static [RivetEndpoint] method at each Map* call that maps it, or on the abstract [RivetContract] method an override implements; else the document's default). Either the spec requires credentials and anyone can reach the handler: nothing on the action, its controller or base controllers, its route group, or MapControllers() requires authentication, there's no AuthorizeFilter in MvcOptions.Filters and no fallback policy, or what's there names a policy that lets anyone in (one whose only requirement is RequireAssertion(_ => true)), or the Functions trigger is AuthorizationLevel.Anonymous. Or the spec admits anonymous callers (.Anonymous(), .OrAnonymous(), or no security anywhere, which OpenAPI reads as no credentials needed) and the handler requires authentication, so those callers get a 401. Only ASP.NET's own authorization metadata is read; custom filters and middleware are invisible. Schemes and policies aren't compared, only whether authentication is needed at all. When the document declares no security scheme at all, the handlers that require authentication under a spec that says nothing are reported as one RIV4008 naming every endpoint. A spec that says "credentials needed" over an open endpoint is the most dangerous way for it to be looser than the wire, hence an error.Make them agree: authorize the handler ([Authorize], .RequireAuthorization(), an AuthorizeFilter, a fallback policy, or a keyed trigger level) with a policy that requires a user, or let anonymous callers in with [AllowAnonymous]/.AllowAnonymous(), or change the spec (.Secure(...)/.Anonymous(), [RivetSecure]/[RivetAnonymous]). For the summary, declare the document's default in source ([assembly: RivetSecurityScheme(...)], [assembly: RivetGlobalSecurity(0)], [assembly: RivetGlobalSecurityScheme(0, ...)]) and mark the anonymous endpoints .Anonymous().
RIV4009ErrorWhether a handler requires authentication depends on authorization setup --check can't read statically: a RequireAuthorization, AllowAnonymous, AuthorizeFilter, or fallback policy applied only under a condition (an if, ?:, switch, loop, catch, &&/`

Retired IDs ​

Retired IDs are never reused; they keep a tombstone here instead of a table row.

  • RIV1005 (FromHeaderParameterExcluded) — retired in P2 wave 5. [FromHeader] parameters used to be excluded from the contract with this warning; they now map to a first-class header parameter source (in: header in the emitted spec), so the diagnostic no longer exists.
  • RIV1009 (UnsupportedTimeSpan) — retired in 0.49.0. TimeSpan used to emit an untyped (empty) schema with this warning; it now maps to the string System.Text.Json writes (the invariant "c" format, [-][d.]hh:mm:ss[.fffffff]) with x-rivet-csharp-type: TimeSpan, so the diagnostic no longer exists.
  • RIV1011 (UnsupportedChar) — retired in P2 wave 6. char used to emit an untyped (empty) schema with this warning; it now maps to a length-1 string schema (minLength/maxLength: 1 — the System.Text.Json wire shape) with x-rivet-csharp-type: char, so the diagnostic no longer exists.
  • RIV1012 (UnsupportedObject) — retired in P2 wave 6. object used to emit an untyped (empty) schema with this warning; the untyped schema is the honest spec for "any JSON value", so object/object? now map to it deliberately and silently, and the diagnostic no longer exists.
  • RIV1101 (JsonIncludeFieldNotRepresented) — retired in 0.49.0. It was registered in 0.42.0 as a reserved slot for [JsonInclude] shapes the walker couldn't prove statically, but every shape it could meet (mixed accessors, private accessors, included fields) was already worked out, so nothing ever emitted it. A diagnostic that can't fire is a promise nobody checks, so it went.
  • RIV1105 (RivetEnumNamingPolicyWithoutStringConverter) — retired in the converter-family wave (0.44.0). The casing convention now lives in the enum's [JsonConverter] declaration itself (RivetCamelCaseEnumConverter<T> family), so a policy cannot exist without a string wire and the dangling-marker case is unexpressible.
  • RIV2004 (MultipartInputTypeMissing) — retired in 0.50.0. A --from multipart endpoint whose inputTypeName had no definition in types got this warning, telling the producer to ship one. rivet-ts never does, on purpose: it lowers the input into params, and the emitter builds the body inline from them. So inputTypeName is a name hint for that inline body, the warning fired on every such contract with nothing to fix, and it went.
  • RIV3002 (ImportSecuritySchemesDropped) — retired in 0.49.0. It promised that only the first security scheme survived import; nothing has emitted it since 0.41.0, when the importer started keeping every alternative, AND-group and scope. Those now land in generated C# as .Secure(...), .AndSecure(...) and .OrAnonymous(), so the warning had nothing left to warn about.
  • RIV3004 (ImportAdditionalPropertiesDropped) — retired in 0.42.0. A named object declaring both properties and additionalProperties used to lose its extension data with this warning; it now keeps typed properties plus extension data, so nothing is dropped.
  • RIV3007 (ImportAliasRefCycle) — retired in 0.45.0. Nothing ever emitted it: alias $ref cycles are broken before mapping and reported as RIV3001.
  • RIV3012 (ImportEnumConstraintDropped) — retired in 0.49.0. An enum that couldn't become a C# enum (one value, booleans, numbers, [null], mixed or out-of-range values) used to lose its values with this warning, and an untyped one became a string. Every literal enum now keeps them: the C# type comes from the values ({ enum: [true] } is a bool), and the values travel in the generated metadata, so the spec re-emits them.
  • RIV3013 (ImportDeclaredPropertiesDropped) — retired in 0.42.0. An inline object declaring both properties and additionalProperties used to lose its typed properties with this warning; it now keeps both, so nothing is dropped.