JanDeDobbeleer/oh-my-posh · error

Error, no formatter for type

Error message

Error, no formatter for type: %d

What it means

WindowsRegistryKeyValue reads a value from the Windows registry and converts it to a WindowsRegistryValue. The value's binary type (valType) is inspected and dispatched to a formatter for REG_SZ, REG_EXPAND_SZ, REG_DWORD, REG_QWORD, or REG_BINARY. If the type is none of these (or the value is absent, giving valType 0), no formatter exists and this error is returned.

Solutions

  1. Verify the value name and path are correct (a missing value yields valType 0): run `reg query <path> /v <name>` and confirm the type shown is REG_SZ, REG_EXPAND_SZ, REG_DWORD, REG_QWORD, or REG_BINARY.
  2. If the value is REG_MULTI_SZ or another unsupported type, read it via PowerShell instead (Get-ItemProperty) and feed the string into your config, or upvote/add a formatter case in terminal_windows.go.
  3. Use the debug log (`oh-my-posh debug`) to see which key/value produced the failure and confirm the exact registry type with regedit.

Example fix

// before (REG_MULTI_SZ value in theme config)
[[blocks.segments]]
type = "winreg"
properties = { registry_path = "HKLM:\\SOFTWARE\\Foo\\MultiValue" }

// after - point at a supported (REG_SZ) value or export it as a string
[[blocks.segments]]
type = "winreg"
properties = { registry_path = "HKLM:\\SOFTWARE\\Foo\\StringValue" }
Defensive patterns

Strategy: validation

Validate before calling

// PowerShell: confirm the registry value type before pointing the segment at it
$v = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Foo'
(Get-Item 'HKLM:\SOFTWARE\Foo').GetValueKind('MyValue')  # must be String, ExpandString, DWord, QWord or Binary

Prevention

When it happens

Trigger: Calling env.WindowsRegistryKeyValue with a registry path whose value is one of the unsupported registry types (REG_MULTI_SZ, REG_NONE, etc.), or whose type resolves to 0 because the value name does not exist under the opened key.

Common situations: Pointing the segment/config at a REG_MULTI_SZ value (the switch has no case for it); a typo in the value name so GetValue returns type 0; reading a value created by newer Windows versions with exotic types.

Related errors


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

Appendix: source

Thrown at src/runtime/terminal_windows.go:203

	switch valType {
	case windows.REG_SZ, windows.REG_EXPAND_SZ:
		value, _, _ := k.GetStringValue(regKey)
		regValue = &WindowsRegistryValue{ValueType: STRING, String: value}
	case windows.REG_DWORD:
		value, _, _ := k.GetIntegerValue(regKey)
		regValue = &WindowsRegistryValue{ValueType: DWORD, DWord: value, String: fmt.Sprintf("0x%08X", value)}
	case windows.REG_QWORD:
		value, _, _ := k.GetIntegerValue(regKey)
		regValue = &WindowsRegistryValue{ValueType: QWORD, QWord: value, String: fmt.Sprintf("0x%016X", value)}
	case windows.REG_BINARY:
		value, _, _ := k.GetBinaryValue(regKey)
		regValue = &WindowsRegistryValue{ValueType: BINARY, String: string(value)}
	}

	if regValue == nil {
		errorLogMsg := fmt.Sprintf("Error, no formatter for type: %d", valType)
		return nil, errors.New(errorLogMsg)
	}

	log.Debug(fmt.Sprintf("%s(%s): %s", regKey, regValue.ValueType, regValue.String))
	return regValue, nil
}

func (term *Terminal) InWSLSharedDrive() bool {
	return false
}

func (term *Terminal) ConvertToWindowsPath(input string) string {
	return strings.ReplaceAll(input, `\`, "/")
}

func (term *Terminal) ConvertToLinuxPath(input string) string {
	return input
}

View on GitHub (pinned to 0976794618)