BloopAI/vibe-kanban · error · ForcePushErrorWithData

result.message || 'Force push failed'

Error message

result.message || 'Force push failed'

What it means

The forcePush mutation calls workspacesApi.forcePush; if the response reports success=false it throws ForcePushErrorWithData carrying the server-provided message (result.message) or the fallback string 'Force push failed'. It is a generic wrapper around any server-side rejection of a force push, and the response's error field is attached for downstream handling.

Source

Thrown at packages/web-core/src/shared/hooks/useForcePush.ts:27

  ) {
    super(message);
    this.name = 'ForcePushErrorWithData';
  }
}

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

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

View on GitHub (pinned to 4deb7eca8f)

Solutions

  1. Read result.error/result.message in the ForcePushErrorWithData for the server's specific cause and fix that underlying issue
  2. Re-authenticate the Git provider (refresh or regenerate the OAuth token/PAT) in settings and retry
  3. Stop any running attempt/process on the workspace so it is not locked, then force push again
  4. Check branch-protection rules on the remote if pushing to a protected branch, or push to a different branch
  5. Verify network connectivity and the remote URL in the workspace's Git settings

Example fix

// before
throw new ForcePushErrorWithData(
  result.message || 'Force push failed',
  result.error
);
// after
throw new ForcePushErrorWithData(
  result.message || `Force push failed (workspace ${workspaceId})`,
  result.error
);
// caller:
try {
  forcePush({ ... });
} catch (e) {
  if (e instanceof ForcePushErrorWithData) showToast(e.message, e.error);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Before force pushing: ensure workspace is idle and remote creds are valid
if (workspace.isAttemptRunning) return showToast('Stop the running attempt first');
const status = await gitApi.getAuthStatus?.();
if (status && !status.authenticated) return promptReauth();

Type guard

function isForcePushError(e: unknown): e is ForcePushErrorWithData {
  return e instanceof ForcePushErrorWithData;
}

Try / catch

useMutation({...}).mutateAsync(params).catch((e) => {
  if (isForcePushError(e)) {
    showToast(e.message); // e.error holds the structured server reason
  } else {
    showToast('Unexpected force push error');
  }
});

Prevention

When it happens

Trigger: Invoking force push on a workspace when the backend rejects it: remote Git authentication failure (bad/expired credentials or token), the underlying git push --force process fails, the workspace/attempt is currently running and locked, or the remote repository refuses the force push (e.g. protected branch).

Common situations: Expired GitHub/GitLab PAT after rotation or SSO deauthorization; pushing to a branch protected by branch-protection rules; concurrent execution holding the workspace lock; wrong remote URL or network outage during the push.

Related errors


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