projectlombok/lombok · error · AppException
Too many lines in - only 4 expected
Error message
Too many lines in <path> - only 4 expected: <LINE_DESCRIPTIONS>
What it means
PublishToBucket.readCreds parses a credentials file expected to contain exactly 4 non-empty, trimmed lines: accessKey, secretKey, endpoint URL, bucket name (described by LINE_DESCRIPTIONS = "accessKey/secretKey/endpoint/bucket"). If the file contains a 5th non-empty line, readCreds throws this AppException. This is a strict file-shape validation so publish tooling never uploads with ambiguous credentials.
Solutions
- Open the file reported by <path> and delete everything after the 4th non-empty line.
- Ensure exactly 4 non-empty lines in order: accessKey, secretKey, endpoint URL, bucket name; remove inline comments (the parser does not strip '#' comments).
- Regenerate the file from the template shown in the NoSuchFileException message (error 52) rather than editing an old copy.
- If you need more config, move it to a separate file or env vars instead of the 4-line creds file.
Example fix
// before (creds file, 5 lines -> throws) AKIA... secret... https://12345.r2.cloudflarestorage.com lombok-data # rot 2026-09-01 // after (4 lines, no extras) AKIA... secret... https://12345.r2.cloudflarestorage.com lombok-data
Defensive patterns
Strategy: validation
Validate before calling
long nonEmpty = java.nio.file.Files.readAllLines(path).stream().filter(l -> !l.trim().isEmpty()).count(); if (nonEmpty > 4) throw new IllegalStateException(path + " must contain exactly 4 non-empty lines, found " + nonEmpty);
Prevention
- Keep the creds file to exactly 4 non-empty lines: accessKey, secretKey, endpoint, bucket.
- Do not add comments or notes to the file — the parser does not strip '#' comments.
- Regenerate the file from the documented template instead of hand-editing old copies.
- Store extra config elsewhere (env vars, separate file).
When it happens
Trigger: Running the publish flow (go -> readCreds) when the creds file at the configured path has 5 or more non-empty lines after trimming — e.g. extra blank-looking lines with whitespace/comments, a trailing annotation line, duplicated keys appended, or two credential files concatenated.
Common situations: Users append a comment or note line to the creds file; editors add a stray content line; credentials pasted from a wiki include headers; secrets manager exports wrap the 4 values with extra metadata lines.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Expected 3 lines in
- File with bucket endpoint + credentials is not available…
- Minor version must be between 0 and 999
- Lombok supports at most v
- Invalid value
AI-assisted analysis of projectlombok/lombok@6d6a3e9fec (2026-09-07).
Data as JSON: /api/errors/01a5b9a15503cdab.
Report an issue: GitHub.
Appendix: source
Thrown at src/support/lombok/publish/PublishToBucket.java:143
}
}
}
private static final String LINE_DESCRIPTIONS = "accessKey/secretKey/endpoint/bucket";
private void readCreds(Path path) throws AppException {
try {
List<String> lines = Files.readAllLines(path);
String accessKey = null, secretKey = null, endPoint = null, bucketName = null;
for (String line : lines) {
int idx = line.indexOf('#');
if (idx != -1) line = line.substring(0, idx);
line = line.trim();
if (line.isEmpty()) continue;
if (accessKey == null) { accessKey = line; continue; }
if (secretKey == null) { secretKey = line; continue; }
if (endPoint == null) { endPoint = line; continue; }
if (bucketName == null) { bucketName = line; continue; }
throw new AppException("Too many lines in " + path.toAbsolutePath() + " - only 4 expected: " + LINE_DESCRIPTIONS);
}
if (bucketName == null) throw new AppException("Expected 3 lines in " + path.toAbsolutePath() + ": " + LINE_DESCRIPTIONS);
creds = AwsBasicCredentials.create(accessKey, secretKey);
endpoint = URI.create(endPoint);
this.bucketName = bucketName;
} catch (NoSuchFileException e) {
throw new AppException("File with bucket endpoint + credentials is not available. Make file " + path.toAbsolutePath() + "; it should contain something like: \n" +
"123456789abcdef0123456789abcdef0 # this is the access key\n" +
"123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0 # this is the secret\n" +
"https://12345.r2.cloudflarestorage.com # this is the endpoint\n" +
"lombok-data # this is the bucket name");
} catch (IOException e) {
throw new AppException("I/O issue reading creds file " + path.toAbsolutePath() + ": " + e.getClass() + ": " + e.getMessage());
}
}
}
View on GitHub (pinned to 6d6a3e9fec)