JanDeDobbeleer/oh-my-posh · info

missing Brewfather user id (user_id)

Error message

missing Brewfather user id (user_id)

What it means

The brewfather segment queries the Brewfather API with HTTP Basic auth built from a user id and API key. getResult renders the `user_id` template option first; when it resolves to an empty string it cannot authenticate, so this error is returned and the segment disables itself.

Source

Thrown at src/segments/brewfather.go:192

	case BFStatusBrewing:
		return bf.options.String(BFBrewingStatusIcon, "\uF7DE")
	case BFStatusFermenting:
		return bf.options.String(BFFermentingStatusIcon, "\uF499")
	case BFStatusConditioning:
		return bf.options.String(BFConditioningStatusIcon, "\uE372")
	case BFStatusCompleted:
		return bf.options.String(BFCompletedStatusIcon, "\uF7A5")
	case BFStatusArchived:
		return bf.options.String(BFArchivedStatusIcon, "\uF187")
	default:
		return ""
	}
}

func (bf *Brewfather) getResult() (*Batch, error) {
	userID := bf.options.Template(BFUserID, "", bf)
	if userID == "" {
		return nil, errors.New("missing Brewfather user id (user_id)")
	}

	apiKey := bf.options.Template(APIKey, "", bf)
	if apiKey == "" {
		return nil, errors.New("missing Brewfather api key (api_key)")
	}

	batchID := bf.options.Template(BFBatchID, "", bf)
	if batchID == "" {
		return nil, errors.New("missing Brewfather batch id (batch_id)")
	}

	authString := fmt.Sprintf("%s:%s", userID, apiKey)
	authStringb64 := base64.StdEncoding.EncodeToString([]byte(authString))
	authHeader := fmt.Sprintf("Basic %s", authStringb64)
	batchURL := fmt.Sprintf("https://api.brewfather.app/v1/batches/%s", batchID)
	batchReadingsURL := fmt.Sprintf("https://api.brewfather.app/v1/batches/%s/readings", batchID)

View on GitHub (pinned to 0976794618)

Solutions

  1. Add the Brewfather user id from Brewfather app > Settings > Success/Streaming APIs to the segment's user_id property in your theme config.
  2. Verify the template renders non-empty: if user_id uses template syntax (e.g. {{ .Env.BF_USER_ID }}), make sure that env variable is actually set.
  3. If you don't use Brewfather, remove the brewfather segment from the theme.

Example fix

// before - option missing
{
  "type": "brewfather",
  "properties": { "api_key": "xxx", "batch_id": "abc" }
}

// after
{
  "type": "brewfather",
  "properties": { "user_id": "myUserId", "api_key": "xxx", "batch_id": "abc" }
}
Defensive patterns

Strategy: validation

Validate before calling

// check the theme config before rendering
if config.Brewfather.UserID == "" {
    // user_id property missing - segment will not render
}

Prevention

When it happens

Trigger: The segment's `user_id` template property is absent from the theme config, or its template renders to an empty string (e.g. referencing an unset variable/environment template).

Common situations: Copying a brewfather segment block from a theme example without filling in user_id; the Brewfather account's user id not found in Brewfather app Settings > API; template typos like `{{ .UserId }}` that render empty.

Understand the failure class

Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.

Related errors


AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31). Data as JSON: /api/errors/0aa7b3775083128d. Report an issue: GitHub.