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
- Ensure the ZIP contains actual .ttf or .otf files — convert .ttc/.woff2 with fonttools (`fonttools ttLib.woff2 decompress` / split collections) first
- Check the filename extension is exactly .ttf or .otf (not .txt, .md, .bak)
- Re-download the font archive if it appears truncated/renamed
- 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
- Only zip .ttf/.otf files when building custom font archives
- Convert .ttc/.woff2 to .ttf/.otf before installing
- Don't rename font files manually (trailing extensions like .bak break matching)
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
- --data-only and --data-derive contradict each other: one for
- font path must be a valid URL
- no location configured: set city+country or latitude+longitu
- source file %s does not match format %s
- unsupported shell type: %s
AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31).
Data as JSON: /api/errors/7b2055891af18da9.
Report an issue: GitHub.