{"record":{"id":"46983da460b94ed9","repo":"qax-os/excelize","slug":"errunsupportednumberformat","errorCode":"ErrUnsupportedNumberFormat","errorMessage":"unsupported number format token","messagePattern":"unsupported number format token","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"errors.go","lineNumber":200,"sourceCode":"\tErrUnprotectSheet = errors.New(\"worksheet has set no protect\")\n\t// ErrUnprotectSheetPassword defined the error message on remove sheet\n\t// protection with password verification failed.\n\tErrUnprotectSheetPassword = errors.New(\"worksheet protect password not match\")\n\t// ErrUnprotectWorkbook defined the error message on workbook has set no\n\t// protection.\n\tErrUnprotectWorkbook = errors.New(\"workbook has set no protect\")\n\t// ErrUnprotectWorkbookPassword defined the error message on remove workbook\n\t// protection with password verification failed.\n\tErrUnprotectWorkbookPassword = errors.New(\"workbook protect password not match\")\n\t// ErrUnsupportedEncryptMechanism defined the error message on unsupported\n\t// encryption mechanism.\n\tErrUnsupportedEncryptMechanism = errors.New(\"unsupported encryption mechanism\")\n\t// ErrUnsupportedHashAlgorithm defined the error message on unsupported\n\t// hash algorithm.\n\tErrUnsupportedHashAlgorithm = errors.New(\"unsupported hash algorithm\")\n\t// ErrUnsupportedNumberFormat defined the error message on unsupported\n\t// number format expression.\n\tErrUnsupportedNumberFormat = errors.New(\"unsupported number format token\")\n\t// ErrUnsupportedPivotTableShowValuesAsType defined the error message on\n\t// receiving the unsupported pivot table \"show values as\" type.\n\tErrUnsupportedPivotTableShowValuesAsType = errors.New(\"unsupported pivot table show values as type\")\n\t// ErrWorkbookFileFormat defined the error message on receive an\n\t// unsupported workbook file format.\n\tErrWorkbookFileFormat = errors.New(\"unsupported workbook file format\")\n\t// ErrWorkbookPassword defined the error message on receiving the incorrect\n\t// workbook password.\n\tErrWorkbookPassword = errors.New(\"the supplied open workbook password is not correct\")\n)\n\n// ErrSheetNotExist defined an error of sheet that does not exist.\ntype ErrSheetNotExist struct {\n\tSheetName string\n}\n\n// Error returns the error message on receiving the non existing sheet name.\nfunc (err ErrSheetNotExist) Error() string {","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/qax-os/excelize/blob/f2483381fbfbe432a6baa98d48a1c277183f3285/errors.go#L182-L218","documentation":"ErrUnsupportedNumberFormat indicates that a date/time pattern supplied in Options (LongDatePattern, LongTimePattern, ShortDatePattern) is not a valid number format token sequence. The library validates the pattern against its number format parser and rejects invalid tokens.","triggerScenarios":"OpenFile/Open with Options{LongDatePattern: \"0.00\"} or similar numeric-only patterns passed as date/time patterns; also TestNumFmt invalid token cases.","commonSituations":"Passing a raw Excel numFmt code (like 0.00) where a locale-style date pattern is expected; copy-pasted pattern strings from other systems.","solutions":["Use a valid date/time pattern (e.g. \"yyyy-mm-dd\", \"hh:mm:ss\") instead of numeric format codes","Omit the pattern options to use defaults","Check the number format token table in the excelize docs"],"exampleFix":"// before\nf, err := OpenFile(\"Book1.xlsx\", Options{LongDatePattern: \"0.00\"})\n// after\nf, err := OpenFile(\"Book1.xlsx\", Options{LongDatePattern: \"yyyy-mm-dd\"})","handlingStrategy":"validation","validationCode":"// validate patterns contain date/time tokens before passing to Options\nfunc isDatePattern(p string) bool {\n\tfor _, t := range []string{\"yy\", \"mm\", \"dd\", \"hh\", \"ss\"} {\n\t\tif strings.Contains(p, t) { return true }\n\t}\n\treturn false\n}","typeGuard":null,"tryCatchPattern":"f, err := excelize.OpenFile(path, excelize.Options{LongDatePattern: pat})\nif errors.Is(err, excelize.ErrUnsupportedNumberFormat) {\n\treturn retryWithDefaultPattern(path)\n}","preventionTips":["Use locale-style date patterns, not raw numFmt codes like 0.00","Test OpenFile options patterns in CI with a sample workbook","Omit pattern options unless customization is required"],"tags":["go","excelize","number-format","options"],"backgroundTag":"invalid-number-format","analyzedSha":"f2483381fbfbe432a6baa98d48a1c277183f3285","analyzedAt":"2026-09-02T01:26:19.299Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}