Troubleshoot AI Inference
Find the cause of a refused model call, an answer that differs from the request, and an error from the AI Inference Starter Kit endpoint.
This page covers the symptoms of a model call to AI Inference, made by a Function with Azion.AI.run or sent to the endpoint of the AI Inference Starter Kit. A quoted error from the binding is the message of the error that Azion.AI.run throws. A quoted error from the endpoint is the error field of its JSON response.
A model call fails with model not found or not allowed
Azion.AI.run throws this error, and the model does not run:
The model id does not exist, or the account has no access to AI Inference. The message does not say which. A model value copied from an earlier response can also fail, because a response carries the account’s internal id, which the binding can refuse as input.
- Copy the id from the model page: each page in AI models states an id that answers.
- List the ids the account can call:
Azion.AI.models()returns them, as List models shows. - Check the access of the plan: on the Hobby and Pro plans, AI Inference is available upon request, per Access by plan.
With an id from that list, the call returns the model response.
A model call fails with a validation error
Azion.AI.run throws an error that names a type and a field, and the model does not run:
The request body does not match the schema of the model. Required marks a missing field, WrongType a value of the wrong type, Minimum or Maximum a value past a bound, Enum a value outside a fixed set, and OneOf a message that matches no message object.
- Fix the field that path names: Request fields lists each field with its type and bounds.
- Use query and documents on the reranker: the BAAI reranker refuses the
text_1andtext_2pair withRequired, per Reranking requests. - Pick a listed width for dimensions: Qwen3 Embedding 4B refuses a value outside its list with
Enum, per Embedding requests.
Once the body matches the schema, the call returns the model response.
A model call fails with Request failed with status 400
Azion.AI.run throws an error that carries a status and no reason:
The model server refused a request that passed validation. The causes observed are a tools request without tool_choice on Qwen2.5 VL AWQ 3B, Qwen2.5 VL AWQ 7B, or Nanonets-OCR-s, a prompt longer than the context the model serves, stream_options without stream, an unknown tool_choice, a seed that is not an integer, and temperature and top_p at 0 with both penalties at -2.
- Name the tool on the Qwen2.5 VL models: a tool named in
tool_choicereturnstool_calls, as Tool calling shows. Nanonets-OCR-s takes no tools. - Shorten the prompt: AI models states the context length of each model.
- Check the values against the list: Errors lists every request the model server refuses.
After the change, the call returns the model response.
An image request fails with Request failed with status 500
A request with an image_url part throws this error:
The URL in image_url.url does not serve an image, so the model has nothing to read.
- Use a URL that serves an image: an
httpsURL that returns the image, or adata:URL that carries the image in base64, per Message objects.
With a URL that serves an image, the model answers in text.
GPT-OSS 20B returns no content
A response from GPT-OSS 20B carries content set to null and finish_reason set to length.
The model reasons before it answers, and the reasoning counts against max_tokens. With a small max_tokens, the reasoning uses the whole budget, and no answer text remains. The reasoning itself is in reasoning_content.
- Raise max_tokens: leave room for the reasoning and the answer, as Chat completion shows.
With room for both, content carries the answer and finish_reason is stop.
An embedding has 2560 values instead of 4096
A request to Qwen3 Embedding 4B with dimensions set to 4096 returns a vector of 2560 values, which does not match a vector column declared for 4096 values.
The model accepts 4096, but its largest vector has 2560 values. A request without dimensions also returns 2560 values.
- Ask for a width the model returns:
256,512,1024, or2048return that width, per Embedding. - Size the column for 2560 values: when the request asks for
4096or for no width, declare the vector column with 2560 values.
The vector and the column then have the same width.
A request field has no effect
A field in the request body changes nothing in the response, and no error is returned.
The binding accepts a field that the model does not know and ignores it, so a misspelled field name passes silently. A model field in the body is ignored as well: the first argument of Azion.AI.run decides the model.
- Spell the field as the reference lists it: Request fields gives each name.
- Pass the model id as the first argument: change the first argument of
Azion.AI.runto call another model.
With the field spelled as listed, the response reflects it.
Azion.AI is undefined when the Function runs locally
Under azion dev, a call to Azion.AI.run throws this error:
Azion.AI exists only in a deployed Function. Under azion dev, it is undefined, per the AI Inference API.
- Test model calls on a deployed Function: deploy the Function, then send the request to its domain.
On a deployed Function, the call returns the model response.
The endpoint answers Request must be a POST request with JSON body
The endpoint of the AI Inference Starter Kit answers 400 with this body:
The Function the template installs accepts only a POST request whose Content-Type header is exactly application/json. A browser that opens the domain sends a GET, and a client that adds ; charset=utf-8 to the header is refused too.
- Send a POST request: the quickstart shows one with
curl. - Send the header with no parameter: set
Content-Typetoapplication/json.
The endpoint then returns the model response.
The endpoint answers Missing model field or Invalid JSON
The endpoint of the AI Inference Starter Kit answers 400 with one of two bodies. For a body without the model field:
For a body that does not parse as JSON:
The Function the template installs reads the model id from the model field of the body. A body without model, or a body that does not parse as JSON, stops before the model call.
- Add the model field: set
modelto an id from AI models. - Send valid JSON: check the quoting of the body your client sends.
The endpoint then returns the model response.
The endpoint answers AI internal error
The endpoint of the AI Inference Starter Kit answers 500 with this body:
The binding threw an error other than model not found or not allowed or a validation error, such as a refusal from the model server. The body does not carry that error, but the Function the template installs writes it to the console.
- Read the console line of the request: the Functions Console data source of Real-Time Events carries the lines a Function writes, including the error name and message.
- Match the message to its cause: the entries above cover each message observed.
The console line names the refusal, and the fix for that message applies.
The endpoint answers 404 right after the deployment
Right after you deploy the AI Inference Starter Kit, the domain under Visit site answers 404 with Azion’s placeholder page.
The deployment has not propagated to Azion’s data centers yet. Propagation takes several minutes.
- Repeat the request after several minutes: as Open the workload domain describes.
Once the deployment propagates, the domain answers with the Function’s response.
Application Name is refused when you deploy the template
When you deploy the AI Inference Starter Kit, the Application Name field shows this message:
The field accepts letters, numbers, and underscores only, so a hyphen is refused.
- Use underscores: enter a name such as
ai_inference_starter_kit, the default.
The Deploy button then deploys the template.