Skip to content
Docs GitHub

code-mappings

Manage code mappings for stack trace linking

Upload code mappings for stack trace linking

Arguments:

ArgumentDescription
<path>Path to the code mappings JSON file

Options:

OptionDescription
--repo <repo>Repository name (e.g., owner/repo). Auto-detected from git remote if omitted.
--default-branch <default-branch>Default branch name. Auto-detected from git remote HEAD if omitted.

All commands support --json for machine-readable output and --fields to select specific JSON fields.

Terminal window
# Upload code mappings from a JSON file
sentry code-mappings upload mappings.json
# Specify repository explicitly
sentry code-mappings upload mappings.json --repo owner/repo
# Specify repository and default branch
sentry code-mappings upload mappings.json --repo owner/repo --default-branch develop
# Output as JSON
sentry code-mappings upload mappings.json --json

The JSON file must contain an array of objects with stackRoot and sourceRoot:

[
{ "stackRoot": "com/example/module", "sourceRoot": "src/main/java/com/example/module" },
{ "stackRoot": "com/example/other", "sourceRoot": "src/main/java/com/example/other" }
]
  • Repository name and default branch are auto-detected from git remotes if not provided via --repo and --default-branch.
  • Requires an Organization Token with org:ci scope.
  • Mappings are uploaded in batches of 300 per API request.