Skip to content

Design binary: raw OpenAI 403 error leaks stale URL for org verification #718

@kichinosukey

Description

@kichinosukey

Bug

When a user's OpenAI organization is not verified, the design binary ($D generate, $D variants, etc.) displays the raw OpenAI API error response, which contains a stale/broken URL:

API error (403): {
  "error": {
    "message": "Your organization must be verified to use the model `gpt-4o`. Please go to: https://platform.openai.com/settings/organization/general and click on Verify Organization. ..."
  }
}

The URL https://platform.openai.com/settings/organization/general returns a 404. OpenAI appears to have changed their settings page structure.

Root Cause

design/src/generate.ts:61-63 throws the raw API response text without parsing:

if (!response.ok) {
  const error = await response.text();
  throw new Error(`API error (${response.status}): ${error}`);
}

Suggested Fix

Detect 403 responses containing "organization must be verified" and display a user-friendly message with the correct URL. Something like:

if (!response.ok) {
  const error = await response.text();
  if (response.status === 403 && error.includes("organization must be verified")) {
    throw new Error(
      "OpenAI organization verification required.\n" +
      "Go to https://platform.openai.com/settings/organization to verify.\n" +
      "After verification, wait up to 15 minutes for access to propagate."
    );
  }
  throw new Error(`API error (${response.status}): ${error}`);
}

This also prevents leaking raw JSON error responses to the user, which is not a great UX.

Environment

  • gstack version: latest (installed via global)
  • macOS Darwin 24.6.0
  • Triggered by: $D variants --brief "..." --count 3 --output-dir /path/

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