different-ai/openwork · error
team_not_found
team_not_found
Error message
team_not_found
What it means
resolveTeamIds validates each team identifier with parseTeamId; a value that is not a well-formed team ID triggers an immediate 404 team_not_found failure, mirroring the member ID check but for team grants on an LLM provider.
Source
Thrown at ee/apps/den-api/src/routes/org/llm-providers.ts:329
}
return memberIds
}
async function resolveTeamIds(input: {
organizationId: typeof LlmProviderTable.$inferSelect.organizationId
values: string[]
}) {
const uniqueValues = [...new Set(input.values)]
if (uniqueValues.length === 0) {
return [] as TeamId[]
}
const teamIds = uniqueValues.map((value) => {
try {
return parseTeamId(value)
} catch {
throw createFailure(404, "team_not_found")
}
})
const rows = await db
.select({ id: TeamTable.id })
.from(TeamTable)
.where(and(eq(TeamTable.organizationId, input.organizationId), inArray(TeamTable.id, teamIds)))
if (rows.length !== teamIds.length) {
throw createFailure(404, "team_not_found")
}
return teamIds
}
function resolveCredentialColumn(input: {
providerConfig: Record<string, unknown>
existingProvider: Pick<LlmProviderRow, "apiKey" | "providerConfig"> | nullView on GitHub (pinned to 2b7df46e8a)
Solutions
- Replace the malformed value with a valid team table ID from the org's teams list endpoint.
- Confirm the value is a team ID, not a slug, name, or member ID.
- If stored in config/terraform, regenerate the ID from the API rather than editing by hand.
- Enable request logging to see the exact offending value.
Example fix
// before
{ "teamIds": ["platform-team"] }
// after
{ "teamIds": ["team_3d8b21f0-1a2c-4d5e-9f6a-7b8c9d0e1f2a"] } Defensive patterns
Strategy: validation
Validate before calling
const TEAM_ID_RE = /^(team_|t_)?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
if (!values.every(v => TEAM_ID_RE.test(v))) throw new Error('malformed team id'); Type guard
function isTeamId(v: unknown): v is string { return typeof v === 'string' && v.length > 0 && isUuidLike(v) } Try / catch
try { await updateProviderGrants({ teamIds }) } catch (e) { if (e.code === 'team_not_found') console.error('bad team id in payload'); } Prevention
- Fetch team IDs from the org teams endpoint, never hand-edit them
- Keep team slugs/names out of ID fields
- Validate payload shape with a schema (zod) before sending
When it happens
Trigger: An org LLM provider create/update request includes a team ID string that fails parseTeamId (malformed or wrong-entity ID).
Common situations: Client sends a team name/slug instead of an ID; sends a member ID in the teams array; truncated or hand-edited IDs in config files or IaC templates.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- team_not_found (Error; invalid desktop policy team IDs)
- member_not_found
- Agent context diagnostics timeout must be between 1 ms and 3
- Invalid cloud provider sync response.
- Invalid cloud provider sync status.
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/ae0c69c03ef2832f.
Report an issue: GitHub.