{"record":{"id":"fbfcd7478bffc321","repo":"AlistGo/alist","slug":"hash-type-q-requires-meta-format-simplejson","errorCode":null,"errorMessage":"hash_type %q requires meta_format=simplejson","messagePattern":"hash_type %q requires meta_format=simplejson","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/chunker/util.go","lineNumber":44,"sourceCode":"func (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\n\t\t}\n\t\tseen[p] = struct{}{}\n\t\tpaths = append(paths, p)","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/chunker/util.go#L26-L62","documentation":"Cross-field validation in Chunker.validateOptions. Hash values are persisted inside the simplejson metadata files; with meta_format=none there is nowhere to store a hash, so requesting any hash_type other than none together with meta_format=none is rejected at init time.","triggerScenarios":"Configuring a Chunker storage with meta_format: \"none\" while hash_type is \"md5\" or \"sha1\" — including the case where hash_type has a non-empty default left over from a previous configuration.","commonSituations":"Toggling meta_format from simplejson to none to avoid metadata sidecar files but forgetting to reset hash_type; importing a config template that mixes the two options.","solutions":["Set hash_type to \"none\" when meta_format is \"none\"","Or switch meta_format to \"simplejson\" to keep hash verification"],"exampleFix":"// before\n\"meta_format\": \"none\",\n\"hash_type\": \"md5\"\n\n// after\n\"meta_format\": \"none\",\n\"hash_type\": \"none\"","handlingStrategy":"validation","validationCode":"if cfg.MetaFormat == \"none\" && cfg.HashType != \"none\" {\n    return errors.New(\"hash_type requires meta_format=simplejson; set hash_type to none\")\n}","typeGuard":"func hashConfigConsistent(metaFormat, hashType string) bool {\n    return metaFormat != \"none\" || hashType == \"none\"\n}","tryCatchPattern":null,"preventionTips":["Validate cross-field constraints in the config UI before submission","When toggling meta_format to none, auto-reset hash_type to none","Encode option dependencies in the config schema so forms grey out invalid combos"],"tags":["alist","chunker","configuration","validation","cross-field"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}