Skip to content

Troubleshooting return objects

Rasmus Wulff Jensen edited this page Sep 22, 2026 · 2 revisions

Troubleshooting return objects

Most return object errors come from a mismatch between a question attribute and its property type. JevDotNet validates the shape before sending the request.

The exception message names the property or response field and links to the relevant guide. Follow that link first; the checks below cover the most common fixes.

Symptom What to check
No Jev question properties found Add at least one JevChoiceQuestion<T>, JevScoreQuestion<T>, or JevNoulQuestion to a public instance property.
Multiple Jev question attributes on a property Keep one Jev question attribute per property.
Question property is not writable Add a public setter ({ get; set; }).
Duplicate question ID Give attributed properties distinct names; matching is case insensitive.
Empty question Provide nonblank text inside the attribute.
Choice property type error Use the attribute's enum type, its nullable form, or JevChoice<that same enum>.
Score property type error Use double, decimal, a nullable form, or JevScore<that same enum>. A Score property is not an enum property.
Score enum level count error Define between 2 and 10 members and check their numeric order.
Noul property type error Use double, decimal, bool, JevNoul, or a nullable form where applicable.
Custom Noul threshold type error Put threshold only on a bool or bool? property. For a detailed JevNoul, call IsAtLeast(threshold) after evaluation.
Noul True/False criteria error Define both True and False, or neither.

Creation and response errors

The library creates the result with Activator.CreateInstance<T>(). If creation fails, give the result class a public parameterless constructor. The examples use public classes with no declared constructor.

Property names become request question IDs. If the API response has no answer for one of them, evaluation throws a JsonException naming that property. It also rejects a returned answer of the wrong question type or an undeclared Choice enum value. Check that your result type and the API response represent the same question set.

For a detailed answer, the response must also include the fields needed by that type: Choice needs choice, confidence, and probabilities; Score needs score, confidence, probabilities, and legend; Noul needs noul. The exception identifies a missing field when possible. Compare the response shapes in the Choice, Score, and Noul guides.

Client configuration

You can construct JevClient with an API key string, or with JevClientOptions when you need to set a model, endpoint, or HTTP client factory:

string apiKey = Environment.GetEnvironmentVariable("JEV_API_KEY")
    ?? throw new InvalidOperationException("Set JEV_API_KEY first.");

JevClient client = new(apiKey);

The default model is jev-latest and the default endpoint is https://api.typesafe.ai/v1/systemone. If you supply options, ApiKey and Model must not be blank, Endpoint must be an absolute URI, and HttpClientFactory must return an HttpClient. Keep API keys in environment variables or .NET user secrets, not source code. An HTTP error from the API may indicate an invalid key, unavailable model, or incorrect endpoint; check the HTTP status and your configuration.

A minimal working shape

using JevDotNet.Models;

public sealed class Result
{
    [JevNoulQuestion("Is the service unavailable?")]
    public bool? IsUnavailable { get; set; }
}

If this shape works but a larger object does not, add its properties back one at a time and compare each to the type matrix. For a full example, follow Building the return object.

Clone this wiki locally