Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Error: Tuple [...] has incorrect number of columns in C# CodeQL #2706

Closed
Sella-GH opened this issue Jan 21, 2025 · 6 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@Sella-GH
Copy link

While running a scheduled CodeQL run tonight it started to fail when trying to evaluate the queries.

Following log files being shown with the error (and some debug lines)

2025-01-21T13:10:06.2758939Z Starting evaluation of codeql/csharp-queries/API Abuse/CallToGCCollect.ql.
2025-01-21T13:10:06.2768064Z Starting evaluation of codeql/csharp-queries/API Abuse/CallToObsoleteMethod.ql.
2025-01-21T13:10:06.2769474Z Starting evaluation of codeql/csharp-queries/API Abuse/ClassDoesNotImplementEquals.ql.
2025-01-21T13:10:06.2797175Z Starting evaluation of codeql/csharp-queries/API Abuse/ClassImplementsICloneable.ql.
2025-01-21T13:10:06.2817513Z Starting evaluation of codeql/csharp-queries/API Abuse/DisposeNotCalledOnException.ql.
2025-01-21T13:10:06.2819123Z Starting evaluation of codeql/csharp-queries/API Abuse/FormatInvalid.ql.
2025-01-21T13:10:06.2827921Z Starting evaluation of codeql/csharp-queries/API Abuse/InconsistentEqualsGetHashCode.ql.
2025-01-21T13:10:10.0185233Z [1/194 eval 3.7s] Evaluation done; writing results to codeql/csharp-queries/API Abuse/CallToGCCollect.bqrs.
2025-01-21T13:10:10.4471096Z [2/194 eval 4.2s] Evaluation done; writing results to codeql/csharp-queries/API Abuse/CallToObsoleteMethod.bqrs.
2025-01-21T13:10:10.8126847Z [3/194 eval 4.5s] Evaluation done; writing results to codeql/csharp-queries/API Abuse/ClassImplementsICloneable.bqrs.
2025-01-21T13:10:12.8573439Z Starting evaluation of codeql/csharp-queries/API Abuse/IncorrectCompareToSignature.ql.
2025-01-21T13:10:12.8738760Z Starting evaluation of codeql/csharp-queries/API Abuse/IncorrectEqualsSignature.ql.
2025-01-21T13:10:14.4805367Z [4/194 eval 1.6s] Evaluation done; writing results to codeql/csharp-queries/API Abuse/IncorrectCompareToSignature.bqrs.
2025-01-21T13:10:14.4836806Z Starting evaluation of codeql/csharp-queries/API Abuse/NoDisposeCallOnLocalIDisposable.ql.
2025-01-21T13:10:14.6180164Z A fatal error occurred: A tuple in a data extension for the extensible predicate 'sourceModel' has an incorrect number of columns. Expected 10, but was 9.
2025-01-21T13:10:15.6847658Z ##[error]Error running analysis for csharp: Encountered a fatal error while running "/opt/hostedtoolcache/CodeQL/2.20.1/x64/codeql/codeql database run-queries --ram=14567 --threads=4 /home/runner/work/_temp/codeql_databases/csharp --expect-discarded-cache --min-disk-free=1024 -v --intra-layer-parallelism". Exit code was 2 and error was: A fatal error occurred: A tuple in a data extension for the extensible predicate 'sourceModel' has an incorrect number of columns. Expected 10, but was 9. See the logs for more details.
2025-01-21T13:10:15.6894812Z ##[debug]Sending status report: {"action_name":"finish","action_oid":"unknown","action_ref":"b6a472f63d85b9c78a3ac5e89422239fc15e9b3c","action_started_at":"2025-01-21T13:09:38.538Z","action_version":"3.28.1","analysis_key":".github/workflows/codeql.yml:analyze","build_mode":"manual","commit_oid":"849ce79dee3ef79ee7e50a21d03913f98a4b4972","first_party_analysis":true,"job_name":"analyze","job_run_uuid":"00b5dc4b-9b9b-4048-99c1-aedbb8b7b3aa","ref":"refs/heads/main","runner_os":"Linux","started_at":"2025-01-21T13:07:41.332Z","status":"failure","steady_state_default_setup":false,"testing_environment":"","workflow_name":"CodeQL","workflow_run_attempt":2,"workflow_run_id":12887566233,"actions_event_name":"push","languages":"csharp","runner_available_disk_space_bytes":21452361728,"runner_total_disk_space_bytes":77851254784,"cause":"Encountered a fatal error while running \"/opt/hostedtoolcache/CodeQL/2.20.1/x64/codeql/codeql database run-queries --ram=14567 --threads=4 /home/runner/work/_temp/codeql_databases/csharp --expect-discarded-cache --min-disk-free=1024 -v --intra-layer-parallelism\". Exit code was 2 and error was: A fatal error occurred: A tuple in a data extension for the extensible predicate 'sourceModel' has an incorrect number of columns. Expected 10, but was 9. See the logs for more details.","exception":"Error: Encountered a fatal error while running \"/opt/hostedtoolcache/CodeQL/2.20.1/x64/codeql/codeql database run-queries --ram=14567 --threads=4 /home/runner/work/_temp/codeql_databases/csharp --expect-discarded-cache --min-disk-free=1024 -v --intra-layer-parallelism\". Exit code was 2 and error was: A fatal error occurred: A tuple in a data extension for the extensible predicate 'sourceModel' has an incorrect number of columns. Expected 10, but was 9. See the logs for more details.\n    at runCli (/home/runner/work/_actions/github/codeql-action/b6a472f63d85b9c78a3ac5e89422239fc15e9b3c/lib/codeql.js:763:63)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Object.databaseRunQueries (/home/runner/work/_actions/github/codeql-action/b6a472f63d85b9c78a3ac5e89422239fc15e9b3c/lib/codeql.js:478:13)\n    at async runQueries (/home/runner/work/_actions/github/codeql-action/b6a472f63d85b9c78a3ac5e89422239fc15e9b3c/lib/analyze.js:343:13)\n    at async run (/home/runner/work/_actions/github/codeql-action/b6a472f63d85b9c78a3ac5e89422239fc15e9b3c/lib/analyze-action.js:196:24)\n    at async runWrapper (/home/runner/work/_actions/github/codeql-action/b6a472f63d85b9c78a3ac5e89422239fc15e9b3c/lib/analyze-action.js:268:9)","completed_at":"2025-01-21T13:10:15.687Z","matrix_vars":"{\n  \"language\": \"csharp\",\n  \"build-mode\": \"manual\"\n}","runner_arch":"X64","runner_os_release":"6.5.0-1025-azure","codeql_version":"2.20.1","runner_image_version":"20250120.2.0","analyze_failure_language":"csharp","scanned_language_extraction_duration_ms":3,"trap_import_duration_ms":11845}
2025-01-21T13:10:15.8313927Z ##[debug]Node Action run completed with exit code 1
2025-01-21T13:10:15.8316092Z ##[debug]CODEQL_ACTION_FEATURE_MULTI_LANGUAGE='false'
2025-01-21T13:10:15.8316540Z ##[debug]CODEQL_ACTION_FEATURE_SANDWICH='false'
2025-01-21T13:10:15.8317235Z ##[debug]CODEQL_ACTION_FEATURE_SARIF_COMBINE='true'
2025-01-21T13:10:15.8317632Z ##[debug]CODEQL_ACTION_FEATURE_WILL_UPLOAD='true'
2025-01-21T13:10:15.8317993Z ##[debug]CODEQL_ACTION_VERSION='3.28.1'
2025-01-21T13:10:15.8318456Z ##[debug]CODEQL_ACTION_SARIF_RESULTS_OUTPUT_DIR='sarif-results'
2025-01-21T13:10:15.8319120Z ##[debug]CODEQL_ACTION_JOB_STATUS='JOB_STATUS_FAILURE'
2025-01-21T13:10:15.8323168Z ##[debug]Save intra-action state persisted_inputs = [["INPUT_CATEGORY","/language:csharp"],["INPUT_OUTPUT","sarif-results"],["INPUT_UPLOAD","failure-only"],["INPUT_CHECK_NAME",""],["INPUT_CLEANUP-LEVEL","brutal"],["INPUT_RAM",""],["INPUT_ADD-SNIPPETS","false"],["INPUT_SKIP-QUERIES","false"],["INPUT_THREADS",""],["INPUT_CHECKOUT_PATH","/home/runner/work/AzzyBot/AzzyBot"],["INPUT_REF",""],["INPUT_SHA",""],["INPUT_UPLOAD-DATABASE","true"],["INPUT_WAIT-FOR-PROCESSING","true"],["INPUT_TOKEN","***"],["INPUT_MATRIX","{\n  \"language\": \"csharp\",\n  \"build-mode\": \"manual\"\n}"],["INPUT_EXPECT-ERROR","false"]]
2025-01-21T13:10:15.8328322Z ##[debug]Finishing: Perform CodeQL Analysis

My CodeQL configuration:

https://github.com/Sella-GH/AzzyBot/blob/main/.github/workflows/codeql.yml

@aeisenberg
Copy link
Contributor

Thanks for reporting. One of our engineers will be looking at this tomorrow.

@aeisenberg aeisenberg added the bug Something isn't working label Jan 21, 2025
@hvitved
Copy link

hvitved commented Jan 21, 2025

My guess is that somehow an old CLI, which predates support for auto-populating QlBuiltins::ExtensionId columns, is being used with a version of the QL code that requires it.

@aeisenberg
Copy link
Contributor

aeisenberg commented Jan 21, 2025

I don't think that's the case. Here's a failing workflow that is using 2.20.1 (the most recent release).

But I do think there is some mismatch in there. Perhaps the githubsecuritylab/codeql-csharp-queries query pack, is incompatible because it was compiled under an older CLI?

@Sella-GH
Copy link
Author

Sella-GH commented Jan 21, 2025

I already thought it could be that one but that query pack received an update tonight... maybe that's why it's failing.

Edit: According to the repo's source it seems they're using the newest CLI version available.
https://github.com/GitHubSecurityLab/CodeQL-Community-Packs/blob/main/.github/workflows/publish.yml#L9

@Sella-GH
Copy link
Author

Okay I disabled the extension packs and now it works fine again. Seems like this was the cause of the issue.

I am creating an issue in the GitHubSecurityLab Repo and reference this one. Looks like something's wrong there.

@aeisenberg
Copy link
Contributor

Thanks for verifying and following up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants