larksuite/cli · error
copy tar entry: %w; close file: %w
Error message
copy tar entry: %w; close file: %w
What it means
During extraction, io.Copy from the tar entry to the created file failed and closing the partially written file also failed; both errors are joined as 'copy tar entry: %w; close file: %w'. This usually means the disk filled up (or a quota/I/O error) mid-extraction, and the close error compounds it.
Source
Thrown at shortcuts/apps/plugin_common.go:401
switch hdr.Typeflag {
case tar.TypeSymlink, tar.TypeLink:
continue
case tar.TypeDir:
if err := os.MkdirAll(target, 0o755); err != nil { //nolint:forbidigo // shortcuts cannot import internal/vfs; tgz extraction.
return err
}
case tar.TypeReg:
if err := os.MkdirAll(filepath.Dir(target), 0o755); err != nil { //nolint:forbidigo
return err
}
f, err := os.OpenFile(target, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.FileMode(hdr.Mode)&0o755) //nolint:forbidigo
if err != nil {
return err
}
if _, err := io.Copy(f, io.LimitReader(tr, pluginExtractMaxBytes)); err != nil {
if cerr := f.Close(); cerr != nil {
return fmt.Errorf("copy tar entry: %w; close file: %w", err, cerr) //nolint:forbidigo // intermediate helper error; callers wrap as typed
}
return err
}
if err := f.Close(); err != nil {
return err
}
}
}
return nil
}
// pluginStripFirstComponent removes the first path component ("package/foo" → "foo").
func pluginStripFirstComponent(name string) string {
name = filepath.ToSlash(name)
if i := strings.Index(name, "/"); i >= 0 {
return name[i+1:]
}
return ""View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Free disk space in the destination volume and retry the install
- Check filesystem health/quotas on the destination directory's volume
- If persistent, extract to a different destination directory with more space
Example fix
// before $ df -h /root/.lark-cli/plugins -> 100% used // after $ docker system prune # or otherwise free space, then retry lark-cli plugin install --file plugin.tgz
Defensive patterns
Strategy: retry
Validate before calling
// ensure free space in the destination volume before installing // df -h <destDir> (require headroom larger than the archive's extracted size)
Try / catch
if strings.Contains(err.Error(), "copy tar entry") {
// free disk space / check volume health, then retry the install
} Prevention
- Monitor free space on the volume hosting the plugin directory
- Clean old plugin versions and caches before large installs
- Check container/volume disk limits when installing large plugins
When it happens
Trigger: Extracting a plugin whose entry exceeds available disk space or hits an I/O error while the target file cannot be closed cleanly (fd exhaustion, filesystem error).
Common situations: Small containers/VMs with tight disk limits installing large plugins, or full temp volumes during pluginInstallOne/pluginInstallLocal.
Related errors
- invalid chart size: {size!r}
- No visible worksheet matched
- +csv-get truncated the scan range at {actual_range}; narrow
- --max-sheets must be at least 1
- skills state is unreadable
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/08fcf36208017ae7.
Report an issue: GitHub.