{"meta":{"title":"diagnostic export","intro":"[Experimental] Export diagnostic information for a failed analysis.","product":"Security and code quality","breadcrumbs":[{"href":"/en/code-security","title":"Security and code quality"},{"href":"/en/code-security/reference","title":"Reference"},{"href":"/en/code-security/reference/code-scanning","title":"Code scanning"},{"href":"/en/code-security/reference/code-scanning/codeql","title":"CodeQL"},{"href":"/en/code-security/reference/code-scanning/codeql/codeql-cli-manual","title":"CodeQL CLI manual"},{"href":"/en/code-security/reference/code-scanning/codeql/codeql-cli-manual/diagnostic-export","title":"diagnostic export"}],"documentType":"article"},"body":"# diagnostic export\n\n[Experimental] Export diagnostic information for a failed analysis.\n\n> [!NOTE]\n> This content describes the most recent release of the CodeQL CLI. For more information about this release, see https://github.com/github/codeql-cli-binaries/releases.\n>\n> To see details of the options available for this command in an earlier release, run the command with the <span style=\"white-space: nowrap;\">`--help`</span> option in your terminal.\n\n## Synopsis\n\n```shell copy\ncodeql diagnostic export --format=<format> [--output=<output>] <options>...\n```\n\n## Description\n\n\\[Experimental] Export diagnostic information for a failed analysis.\n\nAvailable since `v2.12.6`.\n\n## Options\n\n### Primary Options\n\n#### `--format=<format>`\n\n\\[Mandatory] The format in which to write the results. One of:\n\n`raw`: A list of raw, uninterpreted diagnostic messages as JSON objects.\n\n`sarif-latest`: Static Analysis Results Interchange Format (SARIF), a\nJSON-based format for describing static analysis results. This format\noption uses the most recent supported version (v2.1.0). This option is\nnot suitable for use in automation as it will produce different versions\nof SARIF between different CodeQL versions.\n\n`sarifv2.1.0`: SARIF v2.1.0.\n\n`text`: A bullet point list of diagnostic messages.\n\n#### `-o, --output=<output>`\n\nThe output path to write diagnostic information to.\n\n#### `--sarif-exit-code=<sarifExitCode>`\n\n\\[SARIF formats only] Exit code of the failing process.\n\n#### `--sarif-exit-code-description=<sarifExitCodeDescription>`\n\n\\[SARIF formats only] Reason that the failing process exited.\n\n#### `--sarif-category=<category>`\n\n\\[SARIF formats only] \\[Recommended] Specify a category for this\nanalysis to include in the SARIF output. A category can be used to\ndistinguish multiple analyses performed on the same commit and\nrepository, but on different languages or different parts of the code.\n\nIf you analyze the same version of a code base in several different ways\n(e.g., for different languages) and upload the results to GitHub for\npresentation in Code Scanning, this value should differ between each of\nthe analyses, which tells Code Scanning that the analyses _supplement_\nrather than _supersede_ each other. (The values should be consistent\nbetween runs of the same analysis for _different_ versions of the code\nbase.)\n\nThis value will appear (with a trailing slash appended if not already\npresent) as the `<run>.automationDetails.id` property.\n\n#### `--diagnostic-dir=<diagnosticDirs>`\n\nDirectory containing CodeQL diagnostic messages. You can pass this\nmultiple times to include multiple directories.\n\n### Common options\n\n#### `-h, --help`\n\nShow this help text.\n\n#### `-J=<opt>`\n\n\\[Advanced] Give option to the JVM running the command.\n\n(Beware that options containing spaces will not be handled correctly.)\n\n#### `-v, --verbose`\n\nIncrementally increase the number of progress messages printed.\n\n#### `-q, --quiet`\n\nIncrementally decrease the number of progress messages printed.\n\n#### `--verbosity=<level>`\n\n\\[Advanced] Explicitly set the verbosity level to one of errors,\nwarnings, progress, progress+, progress++, progress+++. Overrides `-v`\nand `-q`.\n\n#### `--logdir=<dir>`\n\n\\[Advanced] Write detailed logs to one or more files in the given\ndirectory, with generated names that include timestamps and the name of\nthe running subcommand.\n\n(To write a log file with a name you have full control over, instead\ngive `--log-to-stderr` and redirect stderr as desired.)\n\n#### `--common-caches=<dir>`\n\n\\[Advanced] Controls the location of cached data on disk that will\npersist between several runs of the CLI, such as downloaded QL packs and\ncompiled query plans. If not set explicitly, this defaults to a\ndirectory named `.codeql` in the user's home directory; it will be\ncreated if it doesn't already exist.\n\nAvailable since `v2.15.2`."}