ipfs/kubo · error

file Rename error: %w, file remove error: %s

Error message

file Rename error: %w, file remove error: %s

What it means

Fired by FSRepo.SetGatewayAddr when the atomic rename of the temp file holding the gateway address fails AND the subsequent cleanup os.Remove of that temp file also fails. The message carries both errors: the original rename error (%w) and the remove error, so the failed temp file's existence is visible.

Source

Thrown at repo/fsrepo/fsrepo.go:449

	}()
	defer f.Close()

	if _, err := fmt.Fprintf(f, "http://%s", addr.String()); err != nil {
		return err
	}
	if err := f.Close(); err != nil {
		return err
	}

	// Atomically rename the temp file to the correct file name.
	err = os.Rename(tmpPath, filepath.Join(r.path, gatewayFile))
	good = err == nil
	if good {
		return nil
	}
	// Remove the temp file when rename return error
	if err1 := os.Remove(tmpPath); err1 != nil {
		return fmt.Errorf("file Rename error: %w, file remove error: %s", err, err1.Error())
	}
	return err
}

// openConfig returns an error if the config file is not present.
func (r *FSRepo) openConfig() error {
	conf, err := serialize.Load(r.configFilePath)
	if err != nil {
		return err
	}
	r.config = conf
	return nil
}

// openUserResourceOverrides will remove all overrides if the file is not present.
// It will error if the decoding fails.
func (r *FSRepo) openUserResourceOverrides() error {
	// This filepath is documented in docs/libp2p-resource-management.md and be kept in sync.

View on GitHub (pinned to 329838acdf)

Solutions

  1. Delete the leftover temp file for the gateway address in the repo directory
  2. Check filesystem permissions and disk health
  3. Restart the daemon to retry the write
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at repo/fsrepo/fsrepo.go:449 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/e5619be7cd4866a2. Report an issue: GitHub.