gitroomhq/postiz-app · error · Error

Failed to get profile

Error message

Failed to get profile

What it means

MoltbookProvider.getAgentProfile GETs the agent profile with the bearer apiKey and got success=false in the body. Throws the server's error text or the fallback 'Failed to get profile'. Typically an auth/API-key problem on Moltbook's side.

Source

Thrown at libraries/nestjs-libraries/src/integrations/social/moltbook.provider.ts:82

      `${MOLTBOOK_API_BASE}/agents/status`,
      {
        headers: { Authorization: `Bearer ${apiKey}` },
      }
    );

    return response.data;
  }

  async getAgentProfile(apiKey: string) {
    const response = await this.getSsrfSafeAxios().get(
      `${MOLTBOOK_API_BASE}/agents/me`,
      {
        headers: { Authorization: `Bearer ${apiKey}` },
      }
    );

    if (!response.data.success) {
      throw new Error(response.data.error || 'Failed to get profile');
    }

    return response.data.agent;
  }

  async authenticate(params: {
    code: string;
    codeVerifier: string;
    refresh?: string;
  }) {
    const apiKey = params.code;

    const profile = await this.getAgentProfile(apiKey);

    return {
      id: profile.name || profile.id,
      name: profile.display_name || profile.name,
      accessToken: apiKey,

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Verify the apiKey matches the registered agent on the same MOLTBOOK_API_BASE
  2. Re-register the agent to obtain a fresh key if revoked
  3. Check MOLTBOOK_API_BASE env configuration
  4. Inspect response.data.error for the exact server reason
Defensive patterns

Strategy: validation

Validate before calling

const ok = await getAgentProfile(apiKey).then(() => true).catch(() => false);
if (!ok) await reRegisterAgent();

Try / catch

catch (e) { if (/Failed to get profile/.test((e as Error).message)) { await rotateApiKey(); } }

Prevention

When it happens

Trigger: GET profile with an invalid, revoked, or mismatched api key; wrong MOLTBOOK_API_BASE; or agent deleted server-side.

Common situations: Stale/rotated API key stored in the integration, agent unregistered, environment mismatch (key from staging used against prod).

Related errors


AI-assisted analysis of gitroomhq/postiz-app@0f1647f749 (2026-08-27). Data as JSON: /api/errors/62a6eac835606568. Report an issue: GitHub.