dagger/dagger · error

failed to create temporary known_hosts file: %w

Error message

failed to create temporary known_hosts file: %w

What it means

mountKnownHosts could not create a temp file for the caller-supplied known_hosts content. A plain os.CreateTemp failure — usually /tmp being unwritable or full inside the engine, or a file-descriptor leak exhausting the process.

Source

Thrown at core/git_remote.go:800

			go func() {
				select {
				case <-waitDone:
				case <-time.After(10 * time.Second):
					_ = unix.Kill(-cmd.Process.Pid, unix.SIGKILL)
				}
			}()
		case <-waitDone:
		}
	}()
	err := cmd.Wait()
	close(waitDone)
	return err
}

func mountKnownHosts(knownHosts string) (string, error) {
	tempFile, err := os.CreateTemp("", "known_hosts")
	if err != nil {
		return "", fmt.Errorf("failed to create temporary known_hosts file: %w", err)
	}

	_, err = tempFile.WriteString(knownHosts)
	if err != nil {
		os.Remove(tempFile.Name())
		return "", fmt.Errorf("failed to write known_hosts content: %w", err)
	}

	err = tempFile.Close()
	if err != nil {
		os.Remove(tempFile.Name())
		return "", fmt.Errorf("failed to close temporary known_hosts file: %w", err)
	}

	return tempFile.Name(), nil
}

func mountResolv(dns *oci.DNSConfig) (string, error) {

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Check /tmp write permissions and free space in the engine container
  2. Look for fd leaks if EMFILE
  3. Retry after the transient condition clears
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at core/git_remote.go:800 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05). Data as JSON: /api/errors/601fd234ba6abec2. Report an issue: GitHub.