{"record":{"id":"46d00d2c0372bc29","repo":"twpayne/chezmoi","slug":"s-unknown-compression-format","errorCode":null,"errorMessage":"%s: unknown compression format","messagePattern":"(.+?): unknown compression format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/chezmoi/compression.go","lineNumber":51,"sourceCode":"\t\tgzipReader, err := gzip.NewReader(bytes.NewReader(data))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn io.ReadAll(gzipReader)\n\tcase CompressionFormatXz:\n\t\txzReader, err := xz.NewReader(bytes.NewReader(data))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn io.ReadAll(xzReader)\n\tcase CompressionFormatZstd:\n\t\tzstdReader, err := zstd.NewReader(bytes.NewReader(data))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn io.ReadAll(zstdReader)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"%s: unknown compression format\", compressionFormat)\n\t}\n}\n","sourceCodeStart":33,"sourceCodeEnd":54,"githubUrl":"https://github.com/twpayne/chezmoi/blob/f901167e4685db90da56d6a2a19df642cb3e0247/internal/chezmoi/compression.go#L33-L54","documentation":"getExternalData decompresses fetched external data based on the declared compression format. When the compressionFormat value does not match any supported format (e.g. gzip, zstd), decompress returns this error instead of guessing. It indicates a bad compressionFormat value in configuration or source state.","triggerScenarios":"An external entry in .chezmoiexternal or the config sets compressionFormat to an unsupported string (typo, wrong case, or a format chezmoi does not implement).","commonSituations":"Typo like 'gzip' vs 'gz' or 'zstd' vs 'zst', copying a compression value from another tool, or a new format added upstream but running an older chezmoi binary.","solutions":["Check the compressionFormat value against chezmoi's supported formats (gzip, zstd) and fix the typo","Remove the compressionFormat attribute if the data is not actually compressed","Upgrade chezmoi if the format is supported in a newer release"],"exampleFix":"// before\n[.zshrc]\n  url = \"https://example.com/zshrc.zst\"\n  compressionFormat = \"zstandard\"\n\n// after\n[.zshrc]\n  url = \"https://example.com/zshrc.zst\"\n  compressionFormat = \"zstd\"","handlingStrategy":"validation","validationCode":"supported := map[string]bool{\"gzip\": true, \"zstd\": true}\nif cf != \"\" && !supported[cf] {\n    return fmt.Errorf(\"unsupported compressionFormat %q\", cf)\n}","typeGuard":null,"tryCatchPattern":"data, err := getExternalData(...)\nif err != nil && strings.Contains(err.Error(), \"unknown compression format\") {\n    // fall back or surface config error to user\n}","preventionTips":["Only use documented compressionFormat values: gzip, zstd","Validate external config entries against supported values at startup","Keep chezmoi updated if you need newer compression formats"],"tags":["go","compression","configuration"],"backgroundTag":"unsupported-compression-format","analyzedSha":"f901167e4685db90da56d6a2a19df642cb3e0247","analyzedAt":"2026-09-01T18:16:41.508Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}