BloopAI/vibe-kanban · error · PushErrorWithData

result.message || 'Push failed'

Error message

result.message || 'Push failed'

What it means

The push mutation calls workspacesApi.push; when the response indicates success=false it throws PushErrorWithData with the server's message (result.message) or the fallback 'Push failed'. Like the force-push wrapper, it forwards the structured result.error so callers can branch on the specific failure reason.

Source

Thrown at packages/web-core/src/shared/hooks/usePush.ts:31

}

export function usePush(
  workspaceId?: string,
  onSuccess?: () => void,
  onError?: (
    err: unknown,
    errorData?: PushError,
    params?: PushWorkspaceRequest
  ) => void
) {
  const queryClient = useQueryClient();

  return useMutation<void, unknown, PushWorkspaceRequest>({
    mutationFn: async (params: PushWorkspaceRequest) => {
      if (!workspaceId) return;
      const result = await workspacesApi.push(workspaceId, params);
      if (!result.success) {
        throw new PushErrorWithData(
          result.message || 'Push failed',
          result.error
        );
      }
    },
    onSuccess: () => {
      // A push only affects remote status; invalidate the same branchStatus
      queryClient.invalidateQueries({
        queryKey: ['branchStatus', workspaceId],
      });
      onSuccess?.();
    },
    onError: (err, variables) => {
      console.error('Failed to push:', err);
      const errorData =
        err instanceof PushErrorWithData ? err.errorData : undefined;
      onError?.(err, errorData, variables);
    },

View on GitHub (pinned to 4deb7eca8f)

Solutions

  1. Inspect the PushErrorWithData .error field / server message for the exact git failure and address it (pull/rebase if non-fast-forward)
  2. Re-authenticate the Git provider or fix the credential used by the workspace
  3. Ensure no attempt is currently running on the workspace (lock) and retry
  4. Verify the remote branch exists and your branch has commits to push

Example fix

// before
throw new PushErrorWithData(
  result.message || 'Push failed',
  result.error
);
// after
throw new PushErrorWithData(
  result.message || `Push failed for workspace ${workspaceId}`,
  result.error
);
// caller:
try {
  push(params);
} catch (e) {
  if (e instanceof PushErrorWithData && e.error?.type === 'non_fast_forward') {
    promptPullAndRetry();
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Before pushing: ensure there are commits and remote state is fresh
const behind = await gitApi.isBranchBehind?.(workspaceId);
if (behind) return showToast('Remote is ahead — pull/rebase first');
if (workspace.isAttemptRunning) return showToast('Workspace is busy');

Type guard

function isPushError(e: unknown): e is PushErrorWithData {
  return e instanceof PushErrorWithData;
}

Try / catch

useMutation({...}).mutateAsync(params).catch((e) => {
  if (isPushError(e)) {
    if (e.error?.type === 'non_fast_forward') promptPullAndRetry();
    else showToast(e.message);
  }
});

Prevention

When it happens

Trigger: Invoking push on a workspace when the backend rejects the push: Git credential/token issues, a non-fast-forward remote (remote has commits you don't), merge conflicts blocking the push, workspace locked by a running process, or the git push subprocess failing on the server.

Common situations: Remote branch advanced since the last sync (needs pull/rebase first); expired provider token; pushing with no commits on the task branch; SSH key not loaded on the host running the backend; protected-branch rejection.

Related errors


AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29). Data as JSON: /api/errors/5dcbf09887a72d1d. Report an issue: GitHub.