pinpoint-apm/pinpoint · error · IllegalStateException

Error opening stream :

Error message

Error opening stream : 

What it means

parse0(URL) opens an InputStream from the provider URL; if opening the stream throws a plain IOException (anything that is not a Jackson parse/mapping error), it is wrapped in IllegalStateException('Error opening stream : ' + metaUrl).

Source

Thrown at agent-module/plugins-loader/src/main/java/com/navercorp/pinpoint/loader/plugins/trace/yaml/TraceMetadataProviderYamlParser.java:75

            } catch (Exception e) {
                throw new IllegalStateException("Invalid type provider definition : " + url.toString(), e);
            }
        } catch (IOException e) {
            throw new IllegalStateException("IOException parsing " + url.toExternalForm(), e);
        }
    }

    private ParsedTraceMetadata parse0(URL metaUrl) throws IOException {
        try (InputStream inputStream = metaUrl.openStream()) {
            ParsedTraceMetadata parsedTraceMetadata = mapper.readValue(inputStream, ParsedTraceMetadata.class);
            if (parsedTraceMetadata == null) {
                logger.warn("Empty type provider definition. Skipping : {}", metaUrl.toExternalForm());
            }
            return parsedTraceMetadata;
        } catch (JsonParseException | JsonMappingException e) {
            throw new IllegalStateException("Error parsing yml : " + metaUrl, e);
        } catch (IOException e) {
            throw new IllegalStateException("Error opening stream : " + metaUrl, e);
        }
    }

    private String getTypeProviderId(URL metaUrl) {
        try {
            URLConnection urlConnection = metaUrl.openConnection();
            if (urlConnection instanceof JarURLConnection) {
                JarURLConnection jarUrlConnection = (JarURLConnection) urlConnection;
                String jarFileName = new File(jarUrlConnection.getJarFile().getName()).getName();
                String entryFileName = new File(jarUrlConnection.getEntryName()).getName();
                return jarFileName + ":" + entryFileName;
            }
        } catch (IOException e) {
            logger.warn("Error opening : " + metaUrl, e);
            return metaUrl.toExternalForm();
        }
        return metaUrl.toExternalForm();
    }

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Verify the URL exists (Files.exists for file: URLs; curl for remote URLs)
  2. Check the resource is included in the built plugin jar
  3. Fix the resource path/package declaration
  4. Check filesystem permissions or network reachability

Example fix

// before: file never packaged
getResource("/provider.yml")
// after: correct resource path
getResource("/pinpoint/metadata/type-provider.yml")
Defensive patterns

Strategy: try-catch

Validate before calling

URL url = getClass().getResource(path);
if (url == null) {
    throw new FileNotFoundException("type provider not found: " + path);
}
try (InputStream in = url.openStream()) { /* probes availability */ }

Try / catch

try {
    parser.parse(url);
} catch (IllegalStateException e) {
    if (e.getMessage().startsWith("Error opening stream")) {
        // check URL existence/permissions/reachability before retrying
    }
}

Prevention

When it happens

Trigger: metaUrl.openStream() fails: the resource does not exist at that URL, the jar/file is unreadable, or a network-based URL is unreachable.

Common situations: Typo in the packaged resource path; META-INF resource not copied into the jar; file: URL pointing to a deleted file; connection issues for http: URLs.

Understand the failure class

Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/d141bd58ab5f10f8. Report an issue: GitHub.