{"record":{"id":"8ae2b9976b39aa42","repo":"nikivdev/code","slug":"gitedit-publish-failed-http","errorCode":null,"errorMessage":"gitedit publish failed: HTTP {}","messagePattern":"gitedit publish failed: HTTP (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/publish.rs","lineNumber":531,"sourceCode":"        repo_snapshot: Some(snapshot),\n    };\n\n    let base_url = gitedit_api_url(&repo_root);\n    let api_url = format!(\"{}/api/mirrors/sync\", base_url.trim_end_matches('/'));\n    let view_url = format!(\"{}/{}/{}\", base_url.trim_end_matches('/'), owner, repo_name);\n    let token = gitedit_token(&repo_root);\n\n    let client = Client::builder()\n        .timeout(Duration::from_secs(30))\n        .build()\n        .context(\"failed to build HTTP client\")?;\n    let mut request = client.post(&api_url).json(&payload);\n    if let Some(token) = token {\n        request = request.bearer_auth(token);\n    }\n    let response = request.send().context(\"failed to publish to gitedit\")?;\n    if !response.status().is_success() {\n        bail!(\"gitedit publish failed: HTTP {}\", response.status());\n    }\n\n    println!();\n    println!(\"✓ Published to {}\", view_url);\n    Ok(())\n}\n\nfn resolve_repo_name(opts: &PublishOpts, fallback: &str) -> Result<String> {\n    let name = if let Some(name) = opts.name.clone() {\n        name\n    } else if opts.yes {\n        fallback.to_string()\n    } else {\n        print!(\"Repository name [{}]: \", fallback);\n        io::stdout().flush()?;\n        let mut input = String::new();\n        io::stdin().read_line(&mut input)?;\n        let input = input.trim();","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/publish.rs#L513-L549","documentation":"run_gitedit POSTs the project payload to the gitedit API via reqwest; if the HTTP response status is not a success (2xx), it bails with `gitedit publish failed: HTTP <status>`. The status code is the server's verdict — 4xx indicates a client-side problem (bad token, missing fields) and 5xx a server-side problem.","triggerScenarios":"POST to the gitedit API URL returns non-2xx: 401/403 for a missing or invalid bearer token, 404 for a wrong api_url, 409/422 for validation conflicts (e.g. name/owner collisions), 5xx for server errors.","commonSituations":"Expired or revoked gitedit token in the environment; pointing at a staging API URL that moved; publishing a slug that already exists with conflicting metadata; gitedit server downtime.","solutions":["Check the HTTP status in the message: 401/403 → refresh or set the gitedit token; 404 → verify the API URL; 5xx → retry later or check server health","Verify the gitedit token configured for this environment is current","Run with dry-run/inspect the payload if available to catch 422 validation issues (owner, slug, snapshot fields)","Retry on 502/503/504 — transient server errors resolve on their own"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"let token = std::env::var(\"GITEDIT_TOKEN\").ok();\nif token.as_deref().map(str::is_empty) != Some(false) {\n    eprintln!(\"no gitedit token configured; set it before publishing\");\n    std::process::exit(1);\n}\n// optional preflight\nlet health = reqwest::blocking::get(format!(\"{api_url}/health\"))?;\nif !health.status().is_success() { eprintln!(\"gitedit API unhealthy: {}\", health.status()); }","typeGuard":null,"tryCatchPattern":"if let Err(e) = run_gitedit(&opts) {\n    let msg = e.to_string();\n    if let Some(status) = msg.strip_prefix(\"gitedit publish failed: HTTP \") {\n        match status {\n            \"401\" | \"403\" => eprintln!(\"refresh gitedit token\"),\n            \"502\" | \"503\" | \"504\" => eprintln!(\"transient server error; retry\"),\n            _ => eprintln!(\"server rejected publish: {}\", status),\n        }\n    }\n}","preventionTips":["Retry automatically on 5xx with backoff; never retry 4xx","Validate payload fields (owner, slug) against the API schema before POSTing","Monitor the gitedit API URL for version/host changes"],"tags":["http","api","network","gitedit"],"backgroundTag":"http-non-success-status","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}