Significant-Gravitas/AutoGPT · warning · HTTPException

str(exc)

Error message

str(exc)

What it means

HTTP 400 from the admin memory overview endpoint. derive_group_id(user_id) raised ValueError: per backend/copilot/graphiti/client.py:49 it requires a non-empty user_id of only [a-zA-Z0-9_-] (max length enforced) and raises if sanitization would change the input — so empty ids, ids containing other characters (including dots, @, spaces), or over-long ids all fail. The message is forwarded as the response detail.

Source

Thrown at autogpt_platform/backend/backend/api/features/admin/memory_admin_routes.py:303

@router.get("/{user_id}/overview", response_model=MemoryOverview)
async def get_memory_overview(
    request: Request,
    user_id: Annotated[str, Path(description="User id or 'me'")],
    caller_id: Annotated[str, Depends(get_user_id)],
    jwt_payload: Annotated[dict, Security(get_jwt_payload)],
) -> MemoryOverview:
    target = _resolve_user_id(user_id, caller_id)
    _audit_cross_user_access(
        request=request,
        caller_id=caller_id,
        target_id=target,
        jwt_payload=jwt_payload,
    )
    try:
        group_id = derive_group_id(target)
    except ValueError as exc:
        raise HTTPException(status_code=400, detail=str(exc))

    driver = _open_driver(group_id)
    try:
        entities = await _count(driver, "MATCH (n:Entity) RETURN count(n) AS c")
        episodes = await _count(driver, "MATCH (n:Episodic) RETURN count(n) AS c")
        relates = await _count(
            driver, "MATCH ()-[e:RELATES_TO]->() RETURN count(e) AS c"
        )
        mentions = await _count(
            driver, "MATCH ()-[e:MENTIONS]->() RETURN count(e) AS c"
        )
        communities = await _count(driver, "MATCH (n:Community) RETURN count(n) AS c")
    finally:
        await driver.close()

    return MemoryOverview(
        user_id=target,
        group_id=group_id,

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Pass the exact Supabase user UUID (hyphens are allowed) as user_id.
  2. Read the detail message — it distinguishes empty, sanitized-to-empty, and invalid-character cases.
  3. Trim whitespace and re-check the id client-side before calling.
  4. If a legitimately-shaped id still fails, check its length against the group-id cap.

Example fix

// before
fetch(`/admin/memory/users/${encodeURIComponent(email)}/overview`)

// after
fetch(`/admin/memory/users/${encodeURIComponent(user.uuid)}/overview`)
Defensive patterns

Strategy: validation

Validate before calling

const GROUP_ID_RE = /^[A-Za-z0-9_-]+$/;
if (!user_id || !GROUP_ID_RE.test(user_id)) throw new Error('user_id must match [a-zA-Z0-9_-]+');

Type guard

function isValidUserId(id: string): boolean { return /^[A-Za-z0-9_-]+$/.test(id) && id.length > 0; }

Try / catch

try { const o = await memoryOverview(userId); } catch (e) { if (e.status === 400 && /group_id/.test(e.detail)) { /* bad id format: fetch the canonical UUID from the user list and retry once */ } }

Prevention

When it happens

Trigger: GET /admin/memory/users/{user_id}/overview where user_id is empty, contains whitespace/@/unicode (any char outside [a-zA-Z0-9_-]), or exceeds the max group-id length. _resolve_user_id may also pass through a malformed caller-supplied id.

Common situations: Passing an email or display name instead of the UUID user_id; URL-encoding artifacts (%20, %40) reaching the handler; test fixtures with synthetic ids like 'user@example.com'.

Related errors


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