{"record":{"id":"5637df2845c2a03e","repo":"gastownhall/beads","slug":"jira-project-not-configured-set-jira-project-jir","errorCode":null,"errorMessage":"Jira project not configured (set jira.project, jira.projects, or JIRA_PROJECT)","messagePattern":"Jira project not configured \\(set jira\\.project, jira\\.projects, or JIRA_PROJECT\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/jira/tracker.go","lineNumber":77,"sourceCode":"func (t *Tracker) ConfigPrefix() string { return \"jira\" }\n\nfunc (t *Tracker) Init(ctx context.Context, store storage.Storage) error {\n\tt.store = store\n\n\tjiraURL, err := t.getConfig(ctx, \"jira.url\", \"JIRA_URL\")\n\tif err != nil || jiraURL == \"\" {\n\t\treturn fmt.Errorf(\"Jira URL not configured (set jira.url or JIRA_URL)\")\n\t}\n\tt.jiraURL = jiraURL\n\n\t// Resolve project keys: use pre-set keys (from CLI), or fall back to config.\n\tif len(t.projectKeys) == 0 {\n\t\tpluralVal, _ := t.getConfig(ctx, \"jira.projects\", \"JIRA_PROJECTS\")\n\t\tsingularVal, _ := t.getConfig(ctx, \"jira.project\", \"JIRA_PROJECT\")\n\t\tt.projectKeys = tracker.ResolveProjectIDs(nil, pluralVal, singularVal)\n\t}\n\tif len(t.projectKeys) == 0 {\n\t\treturn fmt.Errorf(\"Jira project not configured (set jira.project, jira.projects, or JIRA_PROJECT)\")\n\t}\n\n\tusername, _ := t.getConfig(ctx, \"jira.username\", \"JIRA_USERNAME\")\n\tapiToken, err := t.getConfig(ctx, \"jira.api_token\", \"JIRA_API_TOKEN\")\n\tif err != nil || apiToken == \"\" {\n\t\treturn fmt.Errorf(\"Jira API token not configured (set jira.api_token or JIRA_API_TOKEN)\")\n\t}\n\n\tt.client = NewClient(jiraURL, username, apiToken)\n\n\tapiVersion, _ := t.getConfig(ctx, \"jira.api_version\", \"JIRA_API_VERSION\")\n\tif apiVersion == \"\" {\n\t\tapiVersion = \"3\"\n\t}\n\tt.apiVersion = apiVersion\n\tt.client.APIVersion = apiVersion\n\n\t// Load optional custom status map from all jira.status_map.* config keys.","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/jira/tracker.go#L59-L95","documentation":"Tracker.Init resolves which Jira project keys the tracker operates on. It first honors pre-set keys (from CLI flags), then reads 'jira.projects' (plural) and 'jira.project' (singular) / JIRA_PROJECTS / JIRA_PROJECT through tracker.ResolveProjectIDs. If no keys result, Init fails with this message listing every accepted source.","triggerScenarios":"Init is called with t.projectKeys empty AND all of jira.projects/JIRA_PROJECTS, jira.project/JIRA_PROJECT unset or empty after resolution.","commonSituations":"User set only the URL and token assuming a default project exists; project key set under a wrong config key; CLI flag not forwarded before Init; empty JIRA_PROJECTS exported as ''; multi-project config typo where ResolveProjectIDs receives blank strings.","solutions":["Set jira.projects or JIRA_PROJECTS with the project key(s) (e.g. JIRA_PROJECTS=BEADS,OPS).","Or set the singular jira.project / JIRA_PROJECT.","Or pass project keys via the CLI flags that populate t.projectKeys before Init.","Confirm the keys are actual Jira project keys (uppercase short codes), not project names or issue prefixes.","Check for empty-string env vars — an empty JIRA_PROJECTS can shadow a correct singular value depending on resolution order."],"exampleFix":"// before\ntracker := jira.NewTracker(); _ = tracker.Init(ctx, store)\n// after\ntracker := jira.NewTracker()\ntracker.SetProjectKeys([]string{\"BEADS\"}) // or set JIRA_PROJECTS=BEADS\n_ = tracker.Init(ctx, store)","handlingStrategy":"validation","validationCode":"func hasProjectConfig() bool {\n    return os.Getenv(\"JIRA_PROJECTS\") != \"\" || os.Getenv(\"JIRA_PROJECT\") != \"\"\n}\n// call before Init; or pass keys via tracker's CLI-provided SetProjectKeys","typeGuard":null,"tryCatchPattern":"if err := tracker.Init(ctx, store); err != nil {\n    if strings.Contains(err.Error(), \"Jira project not configured\") {\n        return fmt.Errorf(\"set JIRA_PROJECTS=KEY1,KEY2 before starting\")\n    }\n    return err\n}","preventionTips":["Always configure at least one project key alongside URL and token.","Use real Jira project keys (uppercase codes), not display names.","Beware empty-string JIRA_PROJECTS shadowing JIRA_PROJECT; unset unused vars.","Pass CLI project flags before Init so pre-set keys win.","Verify keys exist in the instance via /rest/api/3/project during onboarding."],"tags":["jira","configuration","projects","environment"],"backgroundTag":"missing-config-key","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}