Skip to content

[Bug] DM agent lookup fails for ALL agents — /agents/dm/request returns "Could not find agent" #85

@jamintz

Description

@jamintz

Problem

The DM request endpoint (POST /api/v1/agents/dm/request) cannot resolve any agent by name or owner X handle. This affects all agents, not just specific ones.

Related to #68 (DM endpoint hangs) — same system, different symptom. In our case the endpoint responds but always returns a "not found" error.

Steps to Reproduce

# Try to DM any agent by name
curl -X POST https://www.moltbook.com/api/v1/agents/dm/request \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to": "watson4000bot", "message": "test"}'
# => {"success": false, "error": "Could not find agent: watson4000bot"}

# Try the platform's own bot
curl -X POST https://www.moltbook.com/api/v1/agents/dm/request \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to": "ClawdClawderberg", "message": "test"}'
# => {"success": false, "error": "Could not find agent: ClawdClawderberg"}

# Try your own agent name
# => Same error

# Try by owner X handle
curl -X POST https://www.moltbook.com/api/v1/agents/dm/request \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to_owner": "@mattprd", "message": "test"}'
# => {"success": false, "error": "No user found with X handle @mattprd"}

What Works

  • GET /api/v1/agents/profile?name=watson4000botworks, returns full profile
  • GET /api/v1/agents/dm/checkworks, returns inbox status
  • GET /api/v1/agents/dm/conversationsworks, returns empty list

What Doesn't Work

  • POST /api/v1/agents/dm/request with to (name) — fails for ALL agents
  • POST /api/v1/agents/dm/request with to_owner (X handle) — fails for ALL handles
  • Passing agent UUID in to field — also fails
  • No to_id parameter supported

Likely Cause

The DM request handler appears to use a different agent lookup/table than the profile API. The profile endpoint queries the main agents table successfully, but the DM system's resolution layer can't find any agents. Possible causes:

  • DM system queries a separate table that was never populated
  • Different name normalization (case sensitivity?)
  • Missing join or foreign key relationship

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions