syncthing/syncthing · error

download: %w

Error message

download: %w

What it means

The GeoIP provider failed before downloading: os.MkdirTemp(p.directory, "geoipupdate") could not create a scratch directory under the configured database directory. The mkdir error is wrapped; the provider loop returns and geo lookups keep using the old (or no) database.

Source

Thrown at lib/geoip/geoip.go:86

// when the context is canceled.
func (p *Provider) Serve(ctx context.Context) error {
	for {
		select {
		case <-ctx.Done():
			return ctx.Err()

		case <-time.After(p.refreshInterval):
			if err := p.download(ctx); err != nil {
				return err
			}
		}
	}
}

func (p *Provider) download(ctx context.Context) error {
	newSubdir, err := os.MkdirTemp(p.directory, "geoipupdate")
	if err != nil {
		return fmt.Errorf("download: %w", err)
	}

	cfg := &geoipupdate.Config{
		URL:               "https://updates.maxmind.com",
		DatabaseDirectory: newSubdir,
		LockFile:          filepath.Join(newSubdir, "geoipupdate.lock"),
		RetryFor:          5 * time.Minute,
		Parallelism:       1,
		AccountID:         p.accountID,
		LicenseKey:        p.licenseKey,
		EditionIDs:        []string{p.edition},
	}

	if err := geoipupdate.NewClient(cfg).Run(ctx); err != nil {
		return fmt.Errorf("download: %w", err)
	}

	dbPath := filepath.Join(newSubdir, p.edition+".mmdb")

View on GitHub (pinned to 058bcd7334)

Solutions

  1. Create the configured GeoIP directory and chown it to the Syncthing user.
  2. Free disk space or remount read-write.
  3. Point the provider at a writable directory in the GUI/config, or disable the GeoIP feature if unwanted.

Example fix

mkdir -p /var/lib/syncthing/geoip && chown syncthing: /var/lib/syncthing/geoip
Defensive patterns

Strategy: validation

Validate before calling

if err := os.MkdirAll(dbDir, 0o755); err != nil { return err }
if err := unix.Access(dbDir, unix.W_OK); err != nil { return fmt.Errorf("db dir not writable: %w", err) }

Try / catch

if err := p.download(ctx); err != nil {
    if errors.Is(err, fs.ErrPathNotFound) || strings.Contains(err.Error(), "no such file") {
        os.MkdirAll(p.directory, 0o755) // self-heal once, then retry next cycle
    }
    log.Warnf("geoip download failed, keeping old db: %v", err)
}

Prevention

When it happens

Trigger: The database directory does not exist, is not writable by the process (EACCES/EROFS), the disk is full (ENOSPC), or the path is not a directory (ENOTDIR).

Common situations: GeoIP enabled in config but the data directory was removed or never created; Syncthing running as a service user without write access to the state dir; read-only container filesystem.

Related errors


AI-assisted analysis of syncthing/syncthing@058bcd7334 (2026-08-15). Data as JSON: /api/errors/9151c70bc3260d1d. Report an issue: GitHub.