Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

Project resolution fails when GitHub API returns transient errors during the fallback query. The resolveProjectV2 function attempts direct lookup via projectV2(number), then falls back to listAccessibleProjectsV2() list search. The fallback path lacked error handling.

Changes

Error handling:

  • Wrapped listAccessibleProjectsV2() calls in try-catch blocks
  • Added error message indicating both resolution methods failed and suggesting transient API issue

Files modified:

  • actions/setup/js/update_project.cjs
  • actions/setup/js/create_project_status_update.cjs

Example:

// Before: fallback query throws uncaught exception
const list = await listAccessibleProjectsV2(projectInfo, github);

// After: graceful handling with context
let list;
try {
  list = await listAccessibleProjectsV2(projectInfo, github);
} catch (fallbackError) {
  const who = projectInfo.scope === "orgs" ? `org ${projectInfo.ownerLogin}` : `user ${projectInfo.ownerLogin}`;
  throw new Error(
    `Unable to resolve project #${projectNumberInt} for ${who}. Both direct projectV2 query and fallback projectsV2 list query failed. This may be a transient GitHub API error. Error: ${getErrorMessage(fallbackError)}`
  );
}

Test coverage:

  • Added tests for double-failure scenario in both update_project.test.cjs and create_project_status_update.test.cjs
Original prompt

Investigate issue in resolving project url in safe outputs:
https://github.com/githubnext/gh-aw/actions/runs/21599060263/job/62240033643
Warning: Direct projectV2(number) query failed; falling back to projectsV2 list search: Request failed due to following response errors:

  • Could not resolve to a ProjectV2 with the number 146.
    GraphQL Error during: Resolving project from URL
    Message: Request failed due to following response errors:
  • Something went wrong while executing your query on 2026-02-02T16:51:33Z. Please include 28C0:BB342:1463F77:5A7CAC4:6980D615 when reporting this issue.
    Errors array (1 error(s)):
    [1] Something went wrong while executing your query on 2026-02-02T16:51:33Z. Please include 28C0:BB342:1463F77:5A7CAC4:6980D615 when reporting this issue.
    Request: {
    "query": "query($login: String!) {\n organization(login: $login) {\n projectsV2(first: 100) {\n totalCount\n nodes {\n id\n number\n title\n closed\n url\n }\n edges {\n node {\n id\n number\n title\n closed\n url\n }\n }\n }\n }\n }",
    "variables": {
    "login": "githubnext"
    }
    }
    Error: Failed to manage project: Request failed due to following response errors:
  • Something went wrong while executing your query on 2026-02-02T16:51:33Z. Please include 28C0:BB342:1463F77:5A7CAC4:6980D615 when reporting this issue.
    GraphQL Error during: update_project

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@mnkiefer mnkiefer marked this pull request as ready for review February 2, 2026 17:16
Copilot AI and others added 2 commits February 2, 2026 17:17
- Wrap listAccessibleProjectsV2 call in try-catch in both update_project.cjs and create_project_status_update.cjs
- Provide clear error message when both direct and fallback queries fail
- Add tests for error handling scenario in both test files
- All existing tests still pass

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
- Combine string concatenation into single template literal in both files
- All tests still passing

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate issue in resolving project URL in safe outputs Fix uncaught exception in project URL resolution fallback path Feb 2, 2026
Copilot AI requested a review from mnkiefer February 2, 2026 17:26
@mnkiefer mnkiefer merged commit 2efd49f into main Feb 2, 2026
118 checks passed
@mnkiefer mnkiefer deleted the copilot/investigate-project-url-issue branch February 2, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants