Troubleshooting
| Issue | Resolution |
|---|---|
You get a 401 or 403 error when calling the API. | Confirm your key and endpoint are correct for the same Azure AI resource. If you recently changed role assignments, wait a few minutes and try again. |
| You get an error about missing environment variables. | Confirm LANGUAGE_KEY and LANGUAGE_ENDPOINT are set in your environment before you run the sample. |
| The Foundry experience doesn’t match the steps. | In the Foundry portal, use the version toggle to switch between Foundry (classic) and Foundry (new), then follow the matching tab in the Foundry section. |
The API returns unknown as the detected language. | The input text might be too short or ambiguous. Provide a longer text sample or set the Country/region hint to improve accuracy. |
The API returns an InvalidCountryHint error. | Confirm the country/region hint code is a valid ISO 3166-1 alpha-2 code (for example, US, FR, JP). |