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

GitLab Duo Workflow create failed with HTTP ${response.statu

Error message

GitLab Duo Workflow create failed with HTTP ${response.status}

What it means

Thrown when the GitLab Duo Workflow create-workflow POST returns a non-2xx status. The message embeds the HTTP status and the error carries it as errorStatus. This call registers a new workflow with the Duo Workflow service before any streaming begins, so failure aborts the request.

Source

Thrown at packages/ai/src/providers/gitlab-duo-workflow.ts:1722

		workflowDefinition,
	});
	const response = await fetchImpl(gitLabApiUrl(baseUrl, "/api/v4/ai/duo_workflows/workflows"), {
		method: "POST",
		headers: {
			Authorization: `Bearer ${apiKey}`,
			"content-type": "application/json",
		},
		body: JSON.stringify(body),
		signal: gitLabDuoWorkflowRestSignal(signal),
	});
	traceGitLabDuoWorkflow("workflow.create.response", {
		status: response.status,
		ok: response.ok,
		namespaceId,
		hasProjectId: Boolean(projectId),
	});
	if (!response.ok) {
		throw new AIError.GitLabDuoWorkflowApiError(
			`GitLab Duo Workflow create failed with HTTP ${response.status}`,
			response.status,
		);
	}
	const payload = (await response.json()) as GitLabCreateWorkflowResponse;
	const workflowId = payload.id ?? payload.workflow_id ?? payload.workflowId;
	if (workflowId === undefined) {
		throw new AIError.ProviderResponseError(
			`GitLab Duo Workflow create response missing workflow id (HTTP ${response.status})`,
			{ provider: "gitlab-duo-agent", kind: "empty-body" },
		);
	}
	traceGitLabDuoWorkflow("workflow.create.id", { workflowId });
	return String(workflowId);
}

async function stopGitLabDuoWorkflow(
	fetchImpl: FetchImpl,

View on GitHub (pinned to 9690622007)

Solutions

  1. Verify the GitLab token has access to the resolved project/namespace (401/403 → re-auth)
  2. Check the base URL is correct for your instance (404 → wrong host or project path)
  3. For 422, inspect the request the client sent — the model/goal inputs may violate GitLab's constraints
  4. For 5xx, check GitLab status and retry

Example fix

// before
baseUrl: "https://wrong-gitlab.example.com"
// after
baseUrl: "https://gitlab.com"
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify project access before creating a workflow:
const res = await fetch(`${gitlabBaseUrl}/api/v4/projects/${encodeURIComponent(projectPath)}`, { headers: { authorization: `Bearer ${token}` } });
if (!res.ok) throw new Error(`Project ${projectPath} not accessible with this token: ${res.status}`);

Type guard

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

Try / catch

try {
  const workflowId = await createWorkflow(...);
} catch (err) {
  if (err instanceof AIError.GitLabDuoWorkflowApiError && err.status === 404) {
    throw new Error("Wrong GitLab base URL or project path — verify instance and project");
  } else if (err instanceof AIError.GitLabDuoWorkflowApiError && err.status >= 500) {
    // GitLab outage — retry with backoff
  } else throw err;
}

Prevention

When it happens

Trigger: POST create returns 401/403 (bad token or no Duo Workflow access), 404 (namespace/project not found or wrong base URL), 422 (invalid workflow request body), or 5xx — with projectId/namespaceId resolved from the request context.

Common situations: Wrong GitLab base URL (self-managed vs gitlab.com); project ID not visible to the token's user; GitLab plan without Duo Workflow; server-side outage.

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/f6157f948d231604. Report an issue: GitHub.