hasura/graphql-engine · error

error creating setup directories: %w

Error message

error creating setup directories: %w

What it means

os.MkdirAll failed while createExecutionDirectory was creating the execution directory for a new `hasura init` project. Wrapped OS error indicates why creation failed.

Source

Thrown at cli/commands/init.go:243

// create the execution directory.
func (o *InitOptions) createExecutionDirectory() error {
	var op errors.Op = "commands.InitOptions.createExecutionDirectory"

	if o.EC.ExecutionDirectory == "" {
		o.EC.ExecutionDirectory = o.InitDir
	} else {
		o.EC.ExecutionDirectory = filepath.Join(o.EC.ExecutionDirectory, o.InitDir)
	}

	// create the execution directory
	if _, err := os.Stat(o.EC.ExecutionDirectory); err == nil {
		return errors.E(op, fmt.Errorf("directory '%s' already exists", o.EC.ExecutionDirectory))
	}

	err := os.MkdirAll(o.EC.ExecutionDirectory, os.ModePerm)
	if err != nil {
		return errors.E(op, fmt.Errorf("error creating setup directories: %w", err))
	}

	return nil
}

// createFiles creates files required by the CLI in the ExecutionDirectory.
func (o *InitOptions) createFiles() error {
	var op errors.Op = "commands.InitOptions.createFiles"
	// create the directory
	err := os.MkdirAll(filepath.Dir(o.EC.ExecutionDirectory), os.ModePerm)
	if err != nil {
		return errors.E(op, fmt.Errorf("error creating setup directories: %w", err))
	}
	// set config object
	config := &cli.Config{
		Version: o.Version,
		ServerConfig: cli.ServerConfig{
			Endpoint: defaultEndpoint,

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Verify write permission on the parent directory and target path
  2. Remove any regular file occupying a needed path component
  3. Init into a writable location (project dir under $HOME or a mounted volume)
Defensive patterns

Strategy: validation

Validate before calling

if err := checkWritableParent(executionDir); err != nil { log.Fatal(err) }

func checkWritableParent(p string) error {
    parent := filepath.Dir(p)
    if err := os.MkdirAll(parent, 0o755); err != nil { return err }
    return syscall.Access(parent, unix.W_OK)
}

Prevention

When it happens

Trigger: Init target parent is read-only, a path component is a file, or permissions deny directory creation at o.EC.ExecutionDirectory.

Common situations: Init into a root-owned or read-only path; nested name like a/b where 'a' is a regular file; disk full or quota exceeded.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/4eb1cc4c38974ac1. Report an issue: GitHub.