{"record":{"id":"892928acc429f44c","repo":"tailscale/tailscale","slug":"reading-child-d-of-x-w","errorCode":null,"errorMessage":"reading child %d of %x: %w","messagePattern":"reading child (.+?) of %x: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tka/tailchonk.go","lineNumber":451,"sourceCode":"\tc.mu.RUnlock()\n\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tif err := c.buildIndexLocked(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.childAUMsFromIndexLocked(prevAUMHash)\n}\n\n// childAUMsFromIndexLocked returns children from the in-memory index. The\n// caller must hold c.mu for reading or writing.\nfunc (c *FS) childAUMsFromIndexLocked(prevAUMHash AUMHash) ([]AUM, error) {\n\tchildren := c.parentIndex[prevAUMHash]\n\tout := make([]AUM, 0, len(children))\n\tfor i, h := range children {\n\t\taum, err := c.aumLocked(h)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"reading child %d of %x: %w\", i, prevAUMHash, err)\n\t\t}\n\t\tout = append(out, aum)\n\t}\n\treturn out, nil\n}\n\nfunc (c *FS) get(h AUMHash) (*fsHashInfo, error) {\n\tdir, base := c.aumDir(h)\n\tf, err := os.Open(filepath.Join(dir, base))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\tm, err := cborDecOpts.DecMode()\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":433,"sourceCodeEnd":469,"githubUrl":"https://github.com/tailscale/tailscale/blob/6e0912f97994f927632b34ae9e63b53d6516a6ac/tka/tailchonk.go#L433-L469","documentation":"While listing an AUM's children from the in-memory index (used by FS.Children), reading one child AUM from disk failed; the message carries the child's position i in the parent's child list and the parent hash. The wrapped error comes from the underlying read: file missing/open error, CBOR decode failure, or an AUM-vs-filename hash mismatch — i.e. the on-disk state diverged from the index.","triggerScenarios":"Calling Children(parentHash) after an indexed AUM file was deleted, truncated, or corrupted behind the running process, or on any I/O error reading it.","commonSituations":"External modification of the TKA directory (ChonkDir requires exclusive write access for the FS's lifetime); disk/filesystem problems; backup or sync tools touching AUM files while tailscaled runs.","solutions":["Unwrap the error to identify the file and cause (missing vs decode vs hash mismatch).","Restore or re-sync the affected AUM from a healthy peer (the remote's MissingAUMs can supply it).","Stop external writers on the TKA directory; reopen the FS after any out-of-band repair so indexes rebuild."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"children, err := fs.Children(parentHash)\nif err != nil {\n\t// unwrap: fs.ErrNotExist => AUM file vanished; cbor decode => corruption\n\treturn fmt.Errorf(\"loading children of %x: %w\", parentHash, err)\n}","preventionTips":["Never mutate the TKA directory while the FS is open — ChonkDir documents exclusive write access.","Reopen the FS (ChonkDir) after any out-of-band repair so indexes rescan cleanly."],"tags":["go","tailscale","tka","storage","corruption","filesystem"],"backgroundTag":"data-corruption","analyzedSha":"6e0912f97994f927632b34ae9e63b53d6516a6ac","analyzedAt":"2026-08-18T08:17:25.280Z","contentChangedAt":"2026-08-18T08:17:25.280Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}