pinpoint-apm/pinpoint · error · IllegalArgumentException

Could not find file.(path:+filePath+)

Error message

Could not find file.(path:+filePath+)

What it means

SslOption.toResource wraps the configured file path in a FileSystemResource and checks exists(); if the resource cannot be created or does not exist on disk, it throws IllegalArgumentException("Could not find file.(path:...)"). This guard exists because gRPC TLS setup (trust certificate / key material) cannot proceed with a missing file. The path comes from client SSL configuration options.

Source

Thrown at grpc/src/main/java/com/navercorp/pinpoint/grpc/client/config/SslOption.java:130

        private Resource toResource(String filePath) {
            if (!StringUtils.hasText(filePath)) {
                return null;
            }

            Resource resource = null;
            if (filePath.startsWith(CLASSPATH_URL_PREFIX)) {
                String path = filePath.substring(CLASSPATH_URL_PREFIX.length());
                resource = FileSystemResource.createResource(basePath, path);
            } else if (filePath.startsWith(FILE_URL_PREFIX)) {
                String path = filePath.substring(FILE_URL_PREFIX.length());
                resource = FileSystemResource.createResource(path);
            }

            if (resource != null && resource.exists()) {
                return resource;
            }
            throw new IllegalArgumentException("Could not find file.(path:" + filePath + ")");
        }

    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("SslOption{");
        sb.append("enable=").append(enable);
        sb.append(", providerType='").append(providerType).append('\'');
        sb.append(", trustCertResource=").append(trustCertResource);
        sb.append('}');
        return sb.toString();
    }
}

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Verify the configured path exists with ls/Files.exists and fix the path in the SSL configuration.
  2. Use an absolute path, or confirm the process working directory makes the relative path resolve correctly.
  3. Ensure the certificate file is mounted/copied into the container or host running the Pinpoint agent/collector.
  4. Check file permissions so the process user can read the file (exists/readable).

Example fix

// before
client.ssl.trustCertificateFile.path=conf/trust-cert.pem
// after
client.ssl.trustCertificateFile.path=/opt/pinpoint/conf/trust-cert.pem
Defensive patterns

Strategy: validation

Validate before calling

java.io.File cert = new File(certPath);
if (!cert.exists() || !cert.canRead()) {
    throw new IllegalStateException("Trust cert not accessible: " + cert.getAbsolutePath());
}

Try / catch

try {
    sslOption = SslOption.create(...);
} catch (IllegalArgumentException e) {
    LOG.error("SSL cert path invalid: {}", e.getMessage());
    // fall back to plaintext or abort startup
}

Prevention

When it happens

Trigger: Calling trustCertResource (via SslOption setup for a gRPC client) with a certificate file path that does not exist, is misspelled, is relative to the wrong working directory, or is unreadable/inaccessible so exists() returns false.

Common situations: Typo in the pinpoint client SSL config (client.ssl.trustCertificateFile.path); deploying to a container where the cert was not volume-mounted; relative path resolved against a different CWD than during local testing; file deleted between config time and connection time.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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