JanDeDobbeleer/oh-my-posh · warning

not a font: %v

Error message

not a font: %v

What it means

`newFont` parses a candidate file extracted from a downloaded font ZIP into a `Font`. oh-my-posh only treats `.ttf` and `.otf` files (case-insensitive) as fonts; any other extension inside the archive triggers this error naming the offending file. It filters out TXT/MD/license files commonly bundled in font zips.

Source

Thrown at src/cli/font/font.go:68

	if font == nil {
		return false
	}

	return f.Name == font.Name
}

func (f *Font) Resolve() (*Font, bool) {
	return nil, false
}

var fontExtensions = map[string]bool{
	".otf": true,
	".ttf": true,
}

func newFont(fileName string, data []byte) (*Font, error) {
	if _, ok := fontExtensions[strings.ToLower(path.Ext(fileName))]; !ok {
		return nil, fmt.Errorf("not a font: %v", fileName)
	}

	font := &Font{
		FileName: fileName,
		Metadata: make(map[nameID]string),
		Data:     data,
	}

	table, ok, err := readNameTable(font.Data)
	if err != nil {
		return nil, err
	}

	if !ok {
		return nil, fmt.Errorf("font %v has no name table", fileName)
	}

	entries, err := parseNameTable(table)

View on GitHub (pinned to 0976794618)

Solutions

  1. Ensure the ZIP contains actual .ttf or .otf files — convert .ttc/.woff2 with fonttools (`fonttools ttLib.woff2 decompress` / split collections) first
  2. Check the filename extension is exactly .ttf or .otf (not .txt, .md, .bak)
  3. Re-download the font archive if it appears truncated/renamed
  4. If packaging your own zip, only include font binaries at the archive root

Example fix

// before: installing a file saved without extension
newFont("JetBrainsMono-Regular", data) // "not a font"
// after
newFont("JetBrainsMono-Regular.ttf", data)
Defensive patterns

Strategy: validation

Validate before calling

ext := strings.ToLower(filepath.Ext(name))
if ext != ".ttf" && ext != ".otf" {
	return fmt.Errorf("skipping %s: only .ttf/.otf supported", name)
}

Type guard

func isFontFile(name string) bool {
	switch strings.ToLower(path.Ext(name)) {
	case ".ttf", ".otf":
		return true
	}
	return false
}

Prevention

When it happens

Trigger: `newFont(fileName, data)` called from `InstallZIP` when iterating ZIP entries whose `path.Ext` is not `.ttf`/`.otf` — e.g. `OFL.txt`, `readme.md`, `FiraCode-Bold.ttf.bak`, or files with uppercase extensions are fine (lowered) but e.g. `.ttc`/`.woff2` are not.

Common situations: Custom font zip containing documentation/LICENSE files (handled — they're skipped, error surfaces only if you call newFont directly or the expected font is missing); font packaged as .ttc (TrueType Collection) which is unsupported; mistyped extension like .ttff.

Related errors


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