can1357/oh-my-pi · error · Error
Unable to find a GitLab Duo Workflow namespace. Set GITLAB_D
Error message
Unable to find a GitLab Duo Workflow namespace. Set GITLAB_DUO_NAMESPACE_ID to a root namespace or GITLAB_DUO_PROJECT_ID to a GitLab project.
What it means
Thrown by discoverGitLabDuoWorkflowRuntimeNamespace when no GitLab Duo Workflow namespace candidate could be resolved: neither the explicit env configuration nor the runtime candidate resolver yielded a selection. The library needs a root namespace (GITLAB_DUO_NAMESPACE_ID) or a project (GITLAB_DUO_PROJECT_ID) to discover Duo Workflow models.
Source
Thrown at packages/catalog/src/discovery/gitlab-duo-workflow.ts:151
): Promise<GitLabDuoWorkflowNamespaceSelection> {
const selection = await selectGitLabDuoWorkflowNamespace(config);
return {
rootNamespaceId: selection.rootNamespaceId,
...(selection.namespacePath ? { namespacePath: selection.namespacePath } : {}),
...(selection.projectPath ? { projectPath: selection.projectPath } : {}),
source: selection.source,
};
}
export async function discoverGitLabDuoWorkflowRuntimeNamespace(
config: GitLabDuoWorkflowDiscoveryConfig,
): Promise<GitLabDuoWorkflowNamespaceSelection> {
const baseUrl = normalizeGitLabBaseUrl(config.baseUrl);
const selection = await selectGitLabDuoWorkflowCandidate(config, baseUrl, resolveRuntimeNamespaceCandidate, true);
if (selection) {
return selection;
}
throw new Error(
"Unable to find a GitLab Duo Workflow namespace. Set GITLAB_DUO_NAMESPACE_ID to a root namespace or GITLAB_DUO_PROJECT_ID to a GitLab project.",
);
}
export async function fetchGitLabDuoWorkflowModels(
config: GitLabDuoWorkflowDiscoveryConfig,
): Promise<readonly ModelSpec<"gitlab-duo-agent">[] | null> {
const selection = await discoverGitLabDuoWorkflowNamespace(config);
const baseUrl = normalizeGitLabBaseUrl(config.baseUrl);
const availability = await fetchAiChatAvailableModels(config, baseUrl, selection.rootNamespaceId);
if (!availability) {
return null;
}
const modelRefs = resolveModelRefs(availability);
if (modelRefs.length === 0) {
return null;
}
return modelRefs.map(model => buildGitLabDuoWorkflowModelSpec(model, baseUrl, selection.rootNamespaceId));View on GitHub (pinned to 9690622007)
Solutions
- Set GITLAB_DUO_PROJECT_ID to a GitLab project with Duo Workflow enabled.
- Or set GITLAB_DUO_NAMESPACE_ID to a root namespace that has Duo model access.
- Verify GITLAB_TOKEN has api scope and Duo Workflow is enabled for the account/instance.
Example fix
// before GITLAB_TOKEN=glpat-... // after GITLAB_TOKEN=glpat-... GITLAB_DUO_PROJECT_ID=my-group/my-project
Defensive patterns
Strategy: validation
Validate before calling
const env = process.env;
if (!env.GITLAB_DUO_NAMESPACE_ID && !env.GITLAB_DUO_PROJECT_ID) {
throw new Error("Set GITLAB_DUO_NAMESPACE_ID (root namespace) or GITLAB_DUO_PROJECT_ID before GitLab Duo discovery");
} Type guard
null
Try / catch
try {
const models = await fetchGitLabDuoWorkflowModels(config);
} catch (err) {
if (err.message.startsWith("Unable to find a GitLab Duo Workflow namespace")) {
logger.error("GitLab Duo namespace not configured", { hasNamespace: !!process.env.GITLAB_DUO_NAMESPACE_ID });
}
throw err;
} Prevention
- Set GITLAB_DUO_PROJECT_ID or GITLAB_DUO_NAMESPACE_ID in CI/local env before discovery.
- Use a root namespace id, not a subgroup.
- Confirm the token has api scope and the namespace has Duo Workflow enabled.
When it happens
Trigger: Calling fetchGitLabDuoWorkflowModels/discovery with config lacking GITLAB_DUO_NAMESPACE_ID and GITLAB_DUO_PROJECT_ID, or with ids pointing at groups/subgroups that are not root namespaces or not Duo-enabled projects.
Common situations: Running against gitlab.com or self-hosted GitLab without Duo Workflow entitlement; GITLAB_DUO_PROJECT_ID pointing at a personal (non-group) project path; token lacking the api scope to enumerate namespaces.
Related errors
- Unable to find a GitLab Duo Workflow namespace with availabl
- gitlab-duo-agent
- Invalid GITLAB_REDIRECT_URI: ${raw}
- GITLAB_REDIRECT_URI must use http:// or https://, got: ${raw
- GITLAB_REDIRECT_URI loopback callbacks must use http://, got
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/3ff619e0dfe0c55b.
Report an issue: GitHub.