{"record":{"id":"26eeaef10e13ff5c","repo":"AlistGo/alist","slug":"metadata-is-too-large","errorCode":null,"errorMessage":"metadata is too large","messagePattern":"metadata is too large","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/chunker/util.go","lineNumber":220,"sourceCode":"\t}\n\tmeta := metadataJSON{\n\t\tVersion:  &version,\n\t\tSize:     &size,\n\t\tChunkNum: &nChunks,\n\t\tMD5:      md5Value,\n\t\tSHA1:     sha1Value,\n\t\tXactID:   xactID,\n\t}\n\tdata, err := json.Marshal(&meta)\n\tif err == nil && len(data) >= maxMetadataSizeWrite {\n\t\treturn nil, errors.New(\"metadata can't be this big\")\n\t}\n\treturn data, err\n}\n\nfunc unmarshalMetadata(data []byte) (*chunkMetadata, error) {\n\tif len(data) > maxMetadataSizeWrite {\n\t\treturn nil, errors.New(\"metadata is too large\")\n\t}\n\tif data == nil || len(data) < 2 || data[0] != '{' || data[len(data)-1] != '}' {\n\t\treturn nil, errors.New(\"invalid json\")\n\t}\n\tvar meta metadataJSON\n\tif err := json.Unmarshal(data, &meta); err != nil {\n\t\treturn nil, err\n\t}\n\tif meta.Version == nil || meta.Size == nil || meta.ChunkNum == nil {\n\t\treturn nil, errors.New(\"missing required field\")\n\t}\n\tif *meta.Version < 1 {\n\t\treturn nil, errors.New(\"wrong version\")\n\t}\n\tif *meta.Size < 0 {\n\t\treturn nil, errors.New(\"negative file size\")\n\t}\n\tif *meta.ChunkNum < 1 || *meta.ChunkNum > maxSafeChunkNumber {","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/chunker/util.go#L202-L238","documentation":"unmarshalMetadata rejects any metadata companion file whose content length exceeds maxMetadataSizeWrite (255 bytes). This is a read-side guard symmetric to the write-side 'metadata can't be this big' check: metadata larger than the cap was never produced by this driver, so it is treated as invalid/corrupt rather than parsed.","triggerScenarios":"Reading a chunked file whose hidden metadata file (e.g. 'file.ext..chunkxx__meta' style companion) is > 255 bytes — caused by manual editing of the metadata file, a different tool writing it, or corruption. Thrown during chunked file open/listing when the metadata object is fetched.","commonSituations":"Users hand-editing metadata JSON on the remote; files chunked by an incompatible/older fork; metadata file concatenated with other content by a sync tool.","solutions":["Restore or regenerate the metadata file — delete the chunked file set and re-upload the original file so the driver writes fresh metadata","If the file was chunked by another tool, re-chunk it with this driver's format","Avoid editing hidden companion files on the chunker's target storage"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"obj, err := fs.Get(ctx, metaPath)\nif err == nil && obj.GetSize() > 255 {\n    return fmt.Errorf(\"metadata object %s is %d bytes (max 255); regenerate it\", metaPath, obj.GetSize())\n}","typeGuard":null,"tryCatchPattern":"if err := chunkerRead(ctx, path); err != nil {\n    if strings.Contains(err.Error(), \"metadata is too large\") {\n        // treat as corrupt: quarantine file set, trigger re-upload workflow\n    }\n}","preventionTips":["Never edit hidden companion metadata files on the target storage","Monitor chunker remotes for foreign/oversized metadata objects"],"tags":["chunker","metadata","corruption","read"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}