dagger/dagger · error

org %q not found

Error message

org %q not found

What it means

OrgDetails queries Dagger Cloud's GraphQL GetOrgDetails operation and returns this error when the server responds successfully but the `org` field is null — i.e. no organization exists under the given name (or the caller lacks access to it). The client treats a null org as a not-found condition rather than a transport failure.

Source

Thrown at internal/cloud/org_sources.go:272

			status
			trialStart
			trialEnd
		}
	}
}
`

func (c *Client) OrgDetails(ctx context.Context, orgName string) (*OrgDetails, error) {
	var data struct {
		Org *OrgDetails `json:"org"`
	}
	if err := c.doGraphQL(ctx, "GetOrgDetails", getOrgDetailsOperation, map[string]any{
		"org": orgName,
	}, &data); err != nil {
		return nil, err
	}
	if data.Org == nil {
		return nil, fmt.Errorf("org %q not found", orgName)
	}
	return data.Org, nil
}

func (c *Client) Plans(ctx context.Context) (*PlansResponse, error) {
	req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.u.JoinPath("/plans").String(), nil)
	if err != nil {
		return nil, err
	}
	resp, err := c.h.Do(req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	if resp.StatusCode < 200 || resp.StatusCode >= 300 {
		return nil, fmt.Errorf("list plans: %s", resp.Status)
	}
	var plans PlansResponse

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Verify the org slug exists (check dagger.cloud or run the command with the correct --organization flag)
  2. Check that the token in DAGGER_CLOUD_TOKEN belongs to that org and has access
  3. Re-derive the org name from `dagger config` / cloud UI instead of hardcoding it
  4. If the org was renamed, update scripts/env vars to the new slug

Example fix

// before
org, err := client.OrgDetails(ctx, os.Getenv("DAGGER_CLOUD_ORG"))
// after
orgName := os.Getenv("DAGGER_CLOUD_ORG")
if orgName == "" {
	return fmt.Errorf("DAGGER_CLOUD_ORG is not set")
}
org, err := client.OrgDetails(ctx, orgName)
if err != nil {
	return fmt.Errorf("check your --organization flag / DAGGER_CLOUD_ORG (%q): %w", orgName, err)
}
Defensive patterns

Strategy: validation

Validate before calling

if orgName == "" {
	return fmt.Errorf("organization name is empty; set DAGGER_CLOUD_ORG or pass --organization")
}
// optionally pre-check the slug format
if strings.ContainsAny(orgName, " /\\") {
	return fmt.Errorf("org slug %q looks invalid", orgName)
}

Try / catch

org, err := client.OrgDetails(ctx, orgName)
if err != nil {
	if strings.Contains(err.Error(), "not found") {
		// fall back to listing orgs or prompting the user
	}
	return err
}

Prevention

When it happens

Trigger: Calling Client.OrgDetails(ctx, orgName) with an org name that does not exist in Dagger Cloud, a mistyped/renamed org slug, or an org the authenticated token cannot see (server returns org: null instead of a GraphQL error).

Common situations: DAGGER_CLOUD_ORG env var set to a stale org name after a rename; typo in `dagger --organization`; token scoped to a different org; org deleted while a cached name was used.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05). Data as JSON: /api/errors/29c79f7a74a5cbca. Report an issue: GitHub.