nikivdev/code · error

gitedit owner not set (use --owner or GITEDIT_OWNER)

Error message

gitedit owner not set (use --owner or GITEDIT_OWNER)

What it means

resolve_gitedit_owner determines which gitedit owner namespace to publish into. It first tries config/derived values, then — when running non-interactively with --yes and no owner was supplied via --owner or GITEDIT_OWNER — it cannot prompt, so it bails with this message. This is a fail-fast guard so unattended runs never hang on stdin.

Source

Thrown at src/publish.rs:594

    if let Ok(owner) = std::env::var("USER") {
        let slug = sanitize_slug(&owner);
        if !slug.is_empty() {
            if opts.yes {
                return Ok(slug);
            }
            print!("gitedit owner [{}]: ", slug);
            io::stdout().flush()?;
            let mut input = String::new();
            io::stdin().read_line(&mut input)?;
            let input = input.trim();
            if input.is_empty() {
                return Ok(slug);
            }
            return Ok(input.to_string());
        }
    }
    if opts.yes {
        bail!("gitedit owner not set (use --owner or GITEDIT_OWNER)");
    }
    print!("gitedit owner: ");
    io::stdout().flush()?;
    let mut input = String::new();
    io::stdin().read_line(&mut input)?;
    let input = input.trim();
    if input.is_empty() {
        bail!("gitedit owner is required");
    }
    Ok(input.to_string())
}

fn gitedit_repo_override(repo_root: &Path) -> (Option<String>, Option<String>) {
    let flow_path = find_flow_toml(repo_root);
    let Some(flow_path) = flow_path else {
        return (None, None);
    };
    let cfg = match config::load(&flow_path) {

View on GitHub (pinned to a747e741ae)

Solutions

  1. Set GITEDIT_OWNER in the environment before running
  2. Pass --owner <name> on the command line
  3. Store the owner in the project's flow.toml / gitedit config so it is derived automatically
  4. Remove --yes to allow the interactive prompt in a terminal

Example fix

// before
ci: f publish -y
// after
export GITEDIT_OWNER=myuser
ci: f publish -y
Defensive patterns

Strategy: validation

Validate before calling

if std::env::var("GITEDIT_OWNER").map(|v| v.trim().is_empty()).unwrap_or(true) {
    eprintln!("GITEDIT_OWNER must be set for non-interactive publish (use --yes)");
    std::process::exit(1);
}

Try / catch

match run(opts) {
    Err(e) if e.to_string().starts_with("gitedit owner not set") => {
        eprintln!("set GITEDIT_OWNER or pass --owner <name> for unattended runs");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Running `publish` with `--yes` against gitedit without `--owner`, without GITEDIT_OWNER in the environment, and with no owner derivable from the project config/URL.

Common situations: CI pipelines and scripted runs passing -y but forgetting the owner env var; GITEDIT_OWNER set only in a shell profile that CI does not source; typo'd env var name.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/ca4f291b270e32cc. Report an issue: GitHub.