Significant-Gravitas/AutoGPT · warning · HTTPException

name is required

Error message

name is required

What it means

Skill-delete endpoint returns 400 when `delete_user_skill(user_id, name)` raises ValueError, with the message passed through verbatim — 'name is required' fires when the provided skill name/slug is empty after normalization (e.g. path segment is empty or whitespace-only). This is a request-shape problem, not a missing skill (that is SkillNotFoundError → 404).

Source

Thrown at autogpt_platform/backend/backend/api/features/v1.py:2781

    summary="Delete a user-distilled copilot skill",
    operation_id="deleteCopilotSkill",
    tags=["skills"],
    dependencies=[Security(requires_user)],
)
async def delete_copilot_skill(
    user_id: Annotated[str, Security(get_user_id)],
    name: str = Path(..., description="Slug of the skill to delete"),
) -> dict[str, str]:
    """Delete a user-distilled skill by slug.

    Built-in defaults are not user-deletable — attempting to delete one
    returns 400.  Missing skills return 404 so the UI can reconcile a
    stale list.
    """
    try:
        slug = await delete_user_skill(user_id, name)
    except ValueError as exc:
        raise HTTPException(status_code=400, detail=str(exc))
    except BuiltInSkillError as exc:
        raise HTTPException(status_code=400, detail=str(exc))
    except SkillNotFoundError as exc:
        raise HTTPException(status_code=HTTP_404_NOT_FOUND, detail=str(exc))
    return {"name": slug}


########################################################
#####################  API KEY ##############################
########################################################


@v1_router.post(
    "/api-keys",
    summary="Create new API key",
    tags=["api-keys"],
    dependencies=[Security(requires_user)],
)

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Always derive the slug from a non-empty selected skill object and guard before calling.
  2. Normalize with trim().toLowerCase() and skip the request when the result is empty.
  3. Note that FastAPI Path params can't normally be empty — so also check for double slashes or encoded emptiness (%20) in the URL.

Example fix

// before
await fetch(`/api/skills/${name}`, {method:'DELETE'});
// after
const slug = name?.trim().toLowerCase();
if (!slug) throw new Error('Select a skill to delete');
await fetch(`/api/skills/${encodeURIComponent(slug)}`, {method:'DELETE'});
Defensive patterns

Strategy: validation

Validate before calling

const slug = name?.trim().toLowerCase();
if (!slug) { show('Select a skill to delete'); return; }
await api.deleteSkill(slug);

Type guard

function isNonEmptySlug(name: unknown): name is string {
  return typeof name === 'string' && name.trim().length > 0;
}

Try / catch

try {
  await api.deleteSkill(slug);
} catch (e) {
  if (e.status === 400 && /name is required/i.test(e.detail)) { fixCaller(); return; }
  throw e;
}

Prevention

When it happens

Trigger: DELETE /skills/{name} where name is empty, only whitespace, or a route constructed with a missing path segment producing an empty string before validation.

Common situations: Frontend building the URL from an undefined/null field and sending '/skills/%20' or '/skills/'; hand-crafted API calls trimming the segment away; test fixtures passing an empty slug.

Related errors


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/f19bc5210d86158c. Report an issue: GitHub.