can1357/oh-my-pi · error · AIError.DevinApiError

Devin AssignModel error ${response.status} ${response.status

Error message

Devin AssignModel error ${response.status} ${response.statusText}: ${new TextDecoder().decode(payload)}

What it means

Thrown by assignDevinModel when the Devin AssignModel HTTP call returns a non-2xx status; the response body text is embedded in the message and the status is attached to the DevinApiError. streamDevin calls this to obtain a per-session model assignment before streaming, so any rejection here aborts the whole request.

Source

Thrown at packages/ai/src/providers/devin.ts:552

	const request = create(AssignModelRequestSchema, {
		metadata: create(MetadataSchema, devinCliMetadata(turn.apiKey)),
		modelRouterUid: model.requestModelId ?? model.id,
		cascadeId: turn.cascadeId,
		chatMessagePrompt: buildRouterPrompt(turn.messages),
	});
	const response = await fetchImpl(`${baseUrl}${DEVIN_ASSIGN_MODEL_PATH}`, {
		method: "POST",
		headers: {
			"content-type": "application/proto",
			"connect-protocol-version": "1",
			accept: "*/*",
		},
		body: toBinary(AssignModelRequestSchema, request),
		signal,
	});
	const payload = new Uint8Array(await response.arrayBuffer());
	if (!response.ok) {
		throw new AIError.DevinApiError(
			`Devin AssignModel error ${response.status} ${response.statusText}: ${new TextDecoder().decode(payload)}`,
			response.status,
		);
	}
	const assignment = decodeDevinUnaryMessage(AssignModelResponseSchema, payload)?.assignment;
	if (!assignment?.assignmentJwt || !assignment.modelUid) {
		throw new AIError.ProviderResponseError(
			"Devin AssignModel error: response carried no assignment JWT and model uid",
			{ provider: model.provider, kind: "runtime" },
		);
	}
	logger.debug("devin: router assigned a model", {
		router: model.requestModelId ?? model.id,
		assigned: assignment.modelUid,
	});
	return assignment;
}

View on GitHub (pinned to 9690622007)

Solutions

  1. Verify the requested model ID/UID is valid and available for your Devin account
  2. Re-authenticate — a stale user JWT can cause 401/403 on AssignModel; retry from the auth step
  3. Read the embedded response body in the message for the server's specific rejection reason
  4. If 429, back off and retry; if 5xx check Devin service health

Example fix

// before: unknown model id
model: "gpt-99-turbo"
// after: a model UID your Devin instance exposes
model: "claude-sonnet-4-5"
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check the model exists on the instance before AssignModel:
const models = await fetch(`${devinBaseUrl}/models`, { headers: { authorization: `Bearer ${jwt}` } }).then(r => r.json());
if (!models.some(m => m.uid === modelUid)) throw new Error(`Model ${modelUid} not available on Devin instance`);

Type guard

function isDevinApiError(err: unknown): err is InstanceType<typeof AIError.DevinApiError> {
  return err instanceof AIError.DevinApiError && typeof err.status === "number";
}

Try / catch

try {
  const assignment = await assignDevinModel(model, request, signal);
} catch (err) {
  if (err instanceof AIError.DevinApiError && err.status === 429) {
    await Bun.sleep(backoffMs); // rate limited — retry after backoff
  } else if (err instanceof AIError.DevinApiError && err.status === 404) {
    throw new Error(`Model ${model.requestModelId ?? model.id} not found — fix the model config`);
  } else throw err;
}

Prevention

When it happens

Trigger: POST AssignModel responds 400/401/403/404/429/500 — invalid model UID in the request, bad auth token from the earlier auth step, the requested model not available to the account, or rate limiting.

Common situations: Requesting a model ID the Devin router does not know or the account cannot access; expired router credentials; Devin service degradation; model UID typo in configuration.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/6a0bb4eb27252507. Report an issue: GitHub.