microsoft/autogen · error · Error

Failed to create run

Error message

Failed to create run

What it means

Thrown by SessionAPI.createRun when POST /runs/ returns falsy status. The payload is {session_id, user_id}; on success it reads data.data.run_id. Failure means the backend refused to start a run — invalid session reference, missing team, or agent-run initialization error surfaced through the envelope.

Source

Thrown at python/packages/autogen-studio/frontend/src/components/views/playground/api.ts:131

      }
    );
    const data = await response.json();
    if (!data.status)
      throw new Error(data.message || "Failed to fetch messages");
    return data.data;
  }

  // New method to create a run
  async createRun(sessionId: number, userId: string): Promise<number> {
    const payload = { session_id: sessionId, user_id: userId };
    const response = await fetch(`${this.getBaseUrl()}/runs/`, {
      method: "POST",
      headers: this.getHeaders(),
      body: JSON.stringify(payload),
    });

    const data = await response.json();
    if (!data.status) throw new Error(data.message || "Failed to create run");
    return data.data.run_id;
  }
}

export const sessionAPI = new SessionAPI();

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Check data.message and backend logs together — run creation failures are almost always logged with the agent build error
  2. Verify sessionAPI.getSession(sessionId, userId) succeeds and references a valid team
  3. Ensure the team's components (model keys, agent configs) are complete before starting a run
  4. Validate required API keys (e.g. model provider keys) exist in backend settings
Defensive patterns

Strategy: validation

Validate before calling

const session = await sessionAPI.getSession(sessionId, userId);
if (!session?.team) throw new Error("Session has no team — cannot start a run");

Type guard

function isRunCreatedEnvelope(x: unknown): x is { status: true; data: { run_id: number } } {
  return !!x && (x as any).status === true && typeof (x as any).data?.run_id === "number";
}

Try / catch

try {
  return await sessionAPI.createRun(sessionId, userId);
} catch (e) {
  notify(`Run not started: ${e instanceof Error ? e.message : e}`);
  throw e;
}

Prevention

When it happens

Trigger: POST /runs/ with a session_id that doesn't exist or lacks a valid team, user_id not matching the session owner, or backend error while constructing the agent runtime for the session's team.

Common situations: Run started before the session's team finished saving, team component references broken (deleted from gallery), backend agent-building error (bad model config keys, missing API keys) wrapped as status:false. Fix order matters: verify the session and its team first, then the backend logs for the agent construction trace.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/ea92000579031a52. Report an issue: GitHub.