{"record":{"id":"e7910c56abc7cc94","repo":"JanDeDobbeleer/oh-my-posh","slug":"missing-brewfather-batch-id-batch-id","errorCode":null,"errorMessage":"missing Brewfather batch id (batch_id)","messagePattern":"missing Brewfather batch id \\(batch_id\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/segments/brewfather.go","lineNumber":202,"sourceCode":"\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)\n\t}\n\n\tbody, err := bf.env.HTTPRequest(batchURL, nil, httpTimeout, addAuthHeader)\n\tif err != nil {\n\t\treturn nil, err","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/segments/brewfather.go#L184-L220","documentation":"The Brewfather segment fetches a specific batch by ID from the Brewfather API. After validating user_id and api_key, getResult() resolves the `batch_id` option; if empty it returns this error instead of calling the API. It is purely a configuration error.","triggerScenarios":"The brewfather segment is enabled with user_id and api_key set, but the `batch_id` option is missing or its template resolves to an empty string.","commonSituations":"User set up credentials but forgot the batch ID; the batch was archived/deleted and the ID removed from config; template referencing a property that no longer exists.","solutions":["Add `batch_id` to the brewfather segment block with the ID of the batch to display (visible in the Brewfather batch URL).","If batch_id is a template expression, confirm the referenced value resolves non-empty in your shell.","Disable the segment if no batch should be tracked."],"exampleFix":"// before\n{\"type\": \"brewfather\", \"user_id\": \"abc\", \"api_key\": \"key\"}\n// after\n{\"type\": \"brewfather\", \"user_id\": \"abc\", \"api_key\": \"key\", \"batch_id\": \"AbCdEf123\"}","handlingStrategy":"validation","validationCode":"if segment.BatchId == \"\" { /* set batch_id from the Brewfather batch URL */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy the batch ID directly from the Brewfather batch URL.","Set batch_id alongside user_id/api_key in the same commit when configuring the segment.","Validate the theme with `oh-my-posh debug`."],"tags":["config","brewfather","missing-option"],"backgroundTag":"missing-option-value","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}