{"record":{"id":"4c5b37716639cff6","repo":"JanDeDobbeleer/oh-my-posh","slug":"missing-brewfather-api-key-api-key","errorCode":null,"errorMessage":"missing Brewfather api key (api_key)","messagePattern":"missing Brewfather api key \\(api_key\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/segments/brewfather.go","lineNumber":197,"sourceCode":"\t\treturn bf.options.String(BFConditioningStatusIcon, \"\\uE372\")\n\tcase BFStatusCompleted:\n\t\treturn bf.options.String(BFCompletedStatusIcon, \"\\uF7A5\")\n\tcase BFStatusArchived:\n\t\treturn bf.options.String(BFArchivedStatusIcon, \"\\uF187\")\n\tdefault:\n\t\treturn \"\"\n\t}\n}\n\nfunc (bf *Brewfather) getResult() (*Batch, error) {\n\tuserID := bf.options.Template(BFUserID, \"\", bf)\n\tif userID == \"\" {\n\t\treturn nil, errors.New(\"missing Brewfather user id (user_id)\")\n\t}\n\n\tapiKey := bf.options.Template(APIKey, \"\", bf)\n\tif apiKey == \"\" {\n\t\treturn nil, errors.New(\"missing Brewfather api key (api_key)\")\n\t}\n\n\tbatchID := bf.options.Template(BFBatchID, \"\", bf)\n\tif batchID == \"\" {\n\t\treturn nil, errors.New(\"missing Brewfather batch id (batch_id)\")\n\t}\n\n\tauthString := fmt.Sprintf(\"%s:%s\", userID, apiKey)\n\tauthStringb64 := base64.StdEncoding.EncodeToString([]byte(authString))\n\tauthHeader := fmt.Sprintf(\"Basic %s\", authStringb64)\n\tbatchURL := fmt.Sprintf(\"https://api.brewfather.app/v1/batches/%s\", batchID)\n\tbatchReadingsURL := fmt.Sprintf(\"https://api.brewfather.app/v1/batches/%s/readings\", batchID)\n\n\thttpTimeout := bf.options.Int(options.HTTPTimeout, options.DefaultHTTPTimeout)\n\n\t// batch\n\taddAuthHeader := func(request *http.Request) {\n\t\trequest.Header.Add(\"authorization\", authHeader)","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/segments/brewfather.go#L179-L215","documentation":"The Brewfather segment requires a Brewfather API key to authenticate against api.brewfather.app. Before making any HTTP request, getResult() resolves the `api_key` template option; if the resolved value is an empty string it returns this error. It is a configuration error, not a network failure.","triggerScenarios":"The brewfather segment is enabled but the `api_key` option (or the template that resolves it) is missing, empty, or evaluates to empty at render time.","commonSituations":"User added the segment to their theme but forgot to add `api_key`; the key was stored in an env var or template expression that resolves to empty in this shell; key was deleted during theme refactoring.","solutions":["Add `api_key` to the brewfather segment block in your theme config with your Brewfather API key (from Brewfather > Settings > API).","If api_key is a template expression, verify the referenced env var/property is set in the shell where the prompt renders.","Temporarily disable the segment if you don't intend to use Brewfather."],"exampleFix":"// before\n{\"type\": \"brewfather\", \"user_id\": \"abc\"}\n// after\n{\"type\": \"brewfather\", \"user_id\": \"abc\", \"api_key\": \"your-brewfather-api-key\"}","handlingStrategy":"validation","validationCode":"// theme config check before enabling the segment\nif segment.ApiKey == \"\" { /* remove segment or set api_key */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set api_key and user_id together when adding the brewfather segment.","Store the key in an env var and reference it via template to avoid committing secrets.","Test the theme with `oh-my-posh debug` to catch missing options early."],"tags":["config","brewfather","missing-option"],"backgroundTag":"missing-api-key","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}