{"record":{"id":"cfdcd8eb4a0e3a3e","repo":"wtfutil/wtf","slug":"missing-environment-variable-token-or-apikey-confi","errorCode":null,"errorMessage":"missing environment variable token or apikey config","messagePattern":"missing environment variable token or apikey config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/asana/widget.go","lineNumber":107,"sourceCode":"\n\tavailableModes := map[string]interface{}{\n\t\t\"project\":          nil,\n\t\t\"project_sections\": nil,\n\t\t\"workspace\":        nil,\n\t}\n\n\tif _, ok := availableModes[mode]; !ok {\n\t\treturn nil, fmt.Errorf(\"missing mode, or mode is invalid - please set to project, project_sections or workspace\")\n\t}\n\n\tif widget.settings.apiKey != \"\" {\n\t\twidget.settings.token = widget.settings.apiKey\n\t} else {\n\t\twidget.settings.token = os.Getenv(\"WTF_ASANA_TOKEN\")\n\t}\n\n\tif widget.settings.token == \"\" {\n\t\treturn nil, fmt.Errorf(\"missing environment variable token or apikey config\")\n\t}\n\n\tsubMode := mode\n\tif allUsers && mode != \"workspace\" {\n\t\tsubMode += \"_all\"\n\t}\n\n\tif projectId == \"\" && strings.HasPrefix(subMode, \"project\") {\n\t\treturn nil, fmt.Errorf(\"missing project id\")\n\t}\n\n\tif workspaceId == \"\" && subMode == \"workspace\" {\n\t\treturn nil, fmt.Errorf(\"missing workspace id\")\n\t}\n\n\tvar tasks []*TaskItem\n\tvar err error\n","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/modules/asana/widget.go#L89-L125","documentation":"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.","triggerScenarios":"Thrown at modules/asana/widget.go:107 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set apiKey in the widget's config, or export WTF_ASANA_TOKEN with a valid personal access token","Confirm the environment variable is visible to the process running wtfutil (check shell profile, systemd environment, etc.)","Generate a new Asana personal access token if the existing one was revoked"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bb838c1ccb0f0f3223690df44afdec663d622881","analyzedAt":"2026-09-03T17:02:45.030Z","contentChangedAt":"2026-09-03T17:02:45.030Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}