wtfutil/wtf · error

missing environment variable token or apikey config

Error message

missing environment variable token or apikey config

What it means

Validation guard fired in Fetch when the widget ends up with no Asana credential. It means neither settings.token nor settings.apiKey was set (apiKey is copied into token if present, otherwise the WTF_ASANA_TOKEN environment variable is read), and both were empty. Fix by setting WTF_ASANA_TOKEN or the apiKey setting in the widget config; Fetch aborts before any API call, so Refresh shows an error instead of task data.

Source

Thrown at modules/asana/widget.go:107

	availableModes := map[string]interface{}{
		"project":          nil,
		"project_sections": nil,
		"workspace":        nil,
	}

	if _, ok := availableModes[mode]; !ok {
		return nil, fmt.Errorf("missing mode, or mode is invalid - please set to project, project_sections or workspace")
	}

	if widget.settings.apiKey != "" {
		widget.settings.token = widget.settings.apiKey
	} else {
		widget.settings.token = os.Getenv("WTF_ASANA_TOKEN")
	}

	if widget.settings.token == "" {
		return nil, fmt.Errorf("missing environment variable token or apikey config")
	}

	subMode := mode
	if allUsers && mode != "workspace" {
		subMode += "_all"
	}

	if projectId == "" && strings.HasPrefix(subMode, "project") {
		return nil, fmt.Errorf("missing project id")
	}

	if workspaceId == "" && subMode == "workspace" {
		return nil, fmt.Errorf("missing workspace id")
	}

	var tasks []*TaskItem
	var err error

View on GitHub (pinned to bb838c1ccb)

Solutions

  1. Set apiKey in the widget's config, or export WTF_ASANA_TOKEN with a valid personal access token
  2. Confirm the environment variable is visible to the process running wtfutil (check shell profile, systemd environment, etc.)
  3. Generate a new Asana personal access token if the existing one was revoked
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/asana/widget.go:107 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03). Data as JSON: /api/errors/cfdcd8eb4a0e3a3e. Report an issue: GitHub.