{"record":{"id":"af2ab06002dc7e0a","repo":"AlistGo/alist","slug":"unsupported-hash-type-s","errorCode":null,"errorMessage":"unsupported hash_type: %s","messagePattern":"unsupported hash_type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/chunker/util.go","lineNumber":41,"sourceCode":"\t\"github.com/alist-org/alist/v3/pkg/utils\"\n)\n\nfunc (d *Chunker) validateOptions() error {\n\tif strings.TrimSpace(d.RemotePath) == \"\" {\n\t\treturn errors.New(\"remote_path is required\")\n\t}\n\tif d.ChunkSize <= 0 {\n\t\treturn errors.New(\"chunk_size must be positive\")\n\t}\n\tswitch d.MetaFormat {\n\tcase \"simplejson\", \"none\":\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported meta_format: %s\", d.MetaFormat)\n\t}\n\tswitch d.HashType {\n\tcase \"none\", \"md5\", \"sha1\":\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported hash_type: %s\", d.HashType)\n\t}\n\tif d.MetaFormat == \"none\" && d.HashType != \"none\" {\n\t\treturn fmt.Errorf(\"hash_type %q requires meta_format=simplejson\", d.HashType)\n\t}\n\treturn nil\n}\n\nfunc (d *Chunker) configuredRemotePaths() []string {\n\tseen := map[string]struct{}{}\n\tpaths := make([]string, 0, 1)\n\taddPath := func(p string) {\n\t\tp = strings.TrimSpace(p)\n\t\tif p == \"\" {\n\t\t\treturn\n\t\t}\n\t\tp = utils.FixAndCleanPath(p)\n\t\tif _, ok := seen[p]; ok {\n\t\t\treturn","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/chunker/util.go#L23-L59","documentation":"Configuration validation error from Chunker.validateOptions. hash_type selects the checksum algorithm stored in chunk metadata for integrity verification; only none, md5, and sha1 are implemented. Any other value fails storage initialization.","triggerScenarios":"Creating or updating a Chunker storage with hash_type set to anything other than \"none\", \"md5\", or \"sha1\" — e.g. \"sha256\", \"crc32\", \"MD5\", or empty string.","commonSituations":"Users assuming sha256/crc32 support because other parts of alist use them; copy-pasting config from tutorials with unsupported values; case-sensitive typos.","solutions":["Set hash_type to one of \"none\", \"md5\", or \"sha1\" exactly","If a stronger hash is required, use \"none\" and verify integrity at the application layer until the driver supports more algorithms"],"exampleFix":"// before\n\"hash_type\": \"sha256\"\n\n// after\n\"hash_type\": \"sha1\"","handlingStrategy":"validation","validationCode":"var validHashTypes = map[string]bool{\"none\": true, \"md5\": true, \"sha1\": true}\n\nif !validHashTypes[strings.TrimSpace(cfg.HashType)] {\n    return fmt.Errorf(\"reject config before init: bad hash_type %q\", cfg.HashType)\n}","typeGuard":"func isValidHashType(v string) bool {\n    switch v {\n    case \"none\", \"md5\", \"sha1\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err := storage.Init(ctx); err != nil {\n    if strings.Contains(err.Error(), \"unsupported hash_type\") {\n        cfg.HashType = \"none\" // safe default, then re-init\n    }\n}","preventionTips":["Use an enum-constrained input for hash_type","Lowercase and trim user input before storing","Default hash_type to none unless integrity metadata is explicitly wanted"],"tags":["alist","chunker","configuration","validation"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}