nexu-io/open-design · error · Error

azure ${resp.status}: ${await resp.text().catch(() => '')}

Error message

azure ${resp.status}: ${await resp.text().catch(() => '')}

What it means

The Azure OpenAI Chat Completions API returned a non-2xx HTTP status during the memory-LLM extraction call. Azure uses a per-deployment URL and api-key header instead of Authorization. The provider.model field is the Azure deployment name, not the model family. The error includes status code and raw body.

Source

Thrown at apps/daemon/src/memory-llm.ts:886

      method: 'POST',
      headers: {
        'content-type': 'application/json',
        'api-key': provider.apiKey,
      },
      body: JSON.stringify({
        response_format: { type: 'json_object' },
        messages: [
          { role: 'system', content: system },
          { role: 'user', content: user },
        ],
      }),
      signal: withTimeout(FETCH_TIMEOUT_MS),
    });
  } catch (err) {
    throw new Error(describeFetchError(err));
  }
  if (!resp.ok) {
    throw new Error(`azure ${resp.status}: ${await resp.text().catch(() => '')}`);
  }
  const json = await resp.json();
  return json?.choices?.[0]?.message?.content ?? '';
}

// Google Gemini's REST surface uses a different request shape:
// system instructions go in `systemInstruction`, the conversation is
// `contents[]` with `role` + `parts`, and the API key is a query
// parameter rather than a header. `responseMimeType: application/json`
// gets us the strict JSON output the parser expects.
async function callGoogle(provider, system, user) {
  const base = String(provider.baseUrl || '').replace(/\/+$/, '');
  const model = encodeURIComponent(provider.model);
  const url = `${base}/v1beta/models/${model}:generateContent?key=${encodeURIComponent(provider.apiKey)}`;
  let resp;
  try {
    resp = await fetch(url, {
      method: 'POST',

View on GitHub (pinned to 5be4028344)

Solutions

  1. Verify the Azure API key is current and has access to the deployment
  2. Confirm provider.model is the exact Azure deployment name (not the model family like 'gpt-4')
  3. Check provider.baseUrl includes the correct resource name and deployment path
  4. Inspect the response body for the specific Azure error code
  5. Retry after a delay if rate-limited (429)
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const text = await callAzure(provider, system, user);
} catch (err) {
  if (err.message.startsWith('azure ')) {
    const status = parseInt(err.message.split(' ')[1], 10);
    if (status === 429) {
      await sleep(backoffMs);
      return callAzure(provider, system, user);
    }
    if (status === 401 || status === 403) {
      throw new Error('Azure OpenAI API key is invalid or lacks deployment access');
    }
  }
  throw err;
}

Prevention

When it happens

Trigger: Invalid Azure API key (401/403); the deployment name in provider.model doesn't exist in the Azure resource; baseUrl doesn't include the correct deployment path; rate limiting (429); quota exceeded.

Common situations: Azure API key rotated in the portal without updating daemon config; deployment deleted or renamed; baseUrl missing or wrong format (must include resource and deployment); confusion between model family name and deployment name.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/b4bbb7c1d6124afd. Report an issue: GitHub.