{"record":{"id":"82353dda6ba5d678","repo":"gitbutlerapp/gitbutler","slug":"push-failed","errorCode":null,"errorMessage":"push failed","messagePattern":"push failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-agentlog/src/gitmeta/write.rs","lineNumber":298,"sourceCode":"    match gitmeta.pull(None) {\n        Ok(_) => {}\n        // An empty metadata remote has no ref yet; the push below initializes it.\n        Err(git_meta_lib::Error::GitCommand(message))\n            if message.contains(\"couldn't find remote ref\") => {}\n        Err(err) => return Err(err).context(\"failed to pull GitMeta metadata\"),\n    }\n\n    let mut attempts = 0;\n    loop {\n        attempts += 1;\n        let output = gitmeta\n            .push_once(None)\n            .context(\"failed to push GitMeta metadata\")?;\n        if output.success {\n            return Ok(());\n        }\n        if !output.non_fast_forward {\n            bail!(\"push failed\");\n        }\n        if attempts >= MAX_RETRIES {\n            bail!(\"push failed after {MAX_RETRIES} attempts\");\n        }\n        gitmeta\n            .resolve_push_conflict(None)\n            .context(\"failed to resolve GitMeta push conflict\")?;\n    }\n}\n\nfn stored_text(kind: RecordKind, text: Option<&str>) -> Option<String> {\n    let text = text?;\n    Some(match kind {\n        RecordKind::ToolResult => redact_text(cap_tool_result_text(text).as_ref()),\n        _ => redact_text(text),\n    })\n}\n","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-agentlog/src/gitmeta/write.rs#L280-L316","documentation":"sync_metadata in crates/but-agentlog/src/gitmeta/write.rs pushes GitMeta metadata with push_once. If the push reports failure and the failure is NOT a non-fast-forward condition (which would be retried after conflict resolution), the code cannot classify or fix it and bails with the bare 'push failed'.","triggerScenarios":"Calling sync_metadata (via run_from_dir) when .push_once(None) returns output.success == false and output.non_fast_forward == false — e.g. remote rejected the push for reasons other than a stale ref.","commonSituations":"Authentication failure against the remote; protected branch rejecting the push; network/remote outage; remote repository unavailable or quota exceeded; GitMeta ref rules disallowing the update.","solutions":["Run the push manually (git push on the GitMeta ref) to see the underlying rejection reason from the remote.","Check credentials/permissions for the remote (token expiry, SSH key, branch protection rules) and fix them.","Verify network/remote availability, then re-run the operation that triggers sync_metadata.","If it was a transient failure, simply retry — non-fast-forward conflicts are retried automatically but other failures are not."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// before triggering sync, check remote reachability and auth\ngit ls-remote <remote> --heads 2>&1 || panic!(\"remote unreachable or auth failed before sync\")","typeGuard":null,"tryCatchPattern":"match sync_metadata(...).context(\"syncing GitMeta\") {\n    Ok(_) => (),\n    Err(e) if e.to_string() == \"push failed\" => {\n        // inspect the real git push error, fix credentials/branch rules, then retry\n        diagnose_push(&gitmeta_remote)?;\n        retry_with_backoff(sync_metadata, 3)?;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Refresh credentials/tokens before long-running sessions that end with a GitMeta push.","Check branch protection rules for the GitMeta ref on the remote.","Run git ls-remote as a preflight in CI or scripts that trigger sync_metadata."],"tags":["git","push","network","remote"],"backgroundTag":"git-command-failed","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}