Fix missing reachability metadata

From oracle/graalvm-reachability-metadata · View interactive version

Fix missing reachability metadata is an AI agent skill from the GitHub repository oracle/graalvm-reachability-metadata. Fix missing GraalVM reachability metadata for a specific library. Use when the user asks to fix or add metadata because required metadata is missing and tests or native-image runs fail with missing metadata errors.

How to use this skill

Skill file

Fix missing reachability metadata entries in the reachability-metadata.json

Overview

Run a reproduce-fix-verify loop for missing metadata errors. Keep running the target test until it passes with no new missing metadata entries.

Library coordinates should be provided in the prompt in the format group:artifact:version. If you are not sure what the coordinates are, ask the user.

Workflow

  1. Reproduce the failure:
  1. Classify the failure:
  1. Capture the missing metadata from the error message:
  1. Choose the target file and insert the entry:
  1. Add the missing condition field:
  1. Verify and iterate:

Error Patterns

Use this reference when deriving the missing entry and condition.

Missing Registration Entry Pattern

Example error shape:

Caused by: org.graalvm.nativeimage.MissingReflectionRegistrationError:
Cannot reflectively invoke constructor 'public org.hibernate.id.enhanced.SequenceStyleGenerator()'
...
add the following to the 'reflection' section of reachability-metadata.json:
{
  "type": "org.hibernate.id.enhanced.SequenceStyleGenerator",
  "methods": [{ "name": "<init>", "parameterTypes": [] }]
}
...
at org.hibernate.boot.model.internal.GeneratorBinder.instantiateGeneratorViaDefaultConstructor(...)
at org.hibernate.resource.beans.internal.Helper$2.produceBeanInstance(...)

Condition Inference

For missing type org.hibernate.id.enhanced.SequenceStyleGenerator, a valid condition class is:

org.hibernate.boot.model.internal.GeneratorBinder

Reason: both share the leading namespace org.hibernate, which is sufficient for this workflow.

Inactive Condition (metadata present but too late)

If GraalVM reports that metadata for an access was found but is inactive because its runtime

condition was not satisfied, treat the existing condition as too late for that access. Read the

access stack and move or duplicate the matching entry under the narrowest library type that is

reached before the access occurs. Do not reuse an unsatisfied condition merely because it relates

to the same library feature.

Environment Troubleshooting

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.