multica-ai/multica · error

write temp config file: %w

Error message

write temp config file: %w

What it means

After creating the temp file, the write of the marshaled JSON failed. The temp file is closed and removed, so no partial file lingers. Typical causes are ENOSPC (disk filled during the write) or EIO on failing storage.

Source

Thrown at server/internal/cli/config.go:362

				return fmt.Errorf("task-local CLI config directory %q escapes root %q", dir, root)
			}
		}
	}
	data, err := json.MarshalIndent(cfg, "", "  ")
	if err != nil {
		return fmt.Errorf("encode CLI config: %w", err)
	}

	// Write to a temp file in the same directory, then rename for atomicity.
	tmp, err := os.CreateTemp(dir, ".config-*.json.tmp")
	if err != nil {
		return fmt.Errorf("create temp config file: %w", err)
	}
	tmpPath := tmp.Name()
	if _, err := tmp.Write(append(data, '\n')); err != nil {
		tmp.Close()
		os.Remove(tmpPath)
		return fmt.Errorf("write temp config file: %w", err)
	}
	if err := tmp.Close(); err != nil {
		os.Remove(tmpPath)
		return fmt.Errorf("close temp config file: %w", err)
	}
	if err := os.Chmod(tmpPath, 0o600); err != nil {
		os.Remove(tmpPath)
		return fmt.Errorf("chmod temp config file: %w", err)
	}
	if err := os.Rename(tmpPath, path); err != nil {
		os.Remove(tmpPath)
		return fmt.Errorf("rename config file: %w", err)
	}
	return nil
}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Free disk space or raise the user quota on the affected filesystem
  2. If on NFS/network storage, remount or reconnect and retry the save
  3. Check dmesg/I/O errors for failing hardware
  4. Retry the command once space is available — the atomic rename means the old config (if any) is still intact
Defensive patterns

Strategy: retry

Try / catch

err := cli.SaveCLIConfig(cfg)
for attempt := 0; errors.Is(err, syscall.ENOSPC) && attempt < 2; attempt++ {
	time.Sleep(time.Second)
	err = cli.SaveCLIConfig(cfg)
}

Prevention

When it happens

Trigger: SaveCLIConfig with the disk filling up between file creation and the (small) write, or a hardware/NFS write error surfacing at write() time.

Common situations: Home partition at 100% capacity; a flaky network mount dropping mid-write; disk quota exceeded for the user.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/46b45ca94f6b3384. Report an issue: GitHub.