{"record":{"id":"dacd06724059a91f","repo":"prestodb/presto","slug":"app-secret-not-provided-in-secretfile","errorCode":null,"errorMessage":"app-secret not provided in \" + secretFile","messagePattern":"app-secret not provided in \" \\+ secretFile","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"presto-lark-sheets/src/main/java/com/facebook/presto/lark/sheets/LarkSheetsUtil.java","lineNumber":54,"sourceCode":"\n    private LarkSheetsUtil() {}\n\n    public static String loadAppSecret(String secretFile)\n    {\n        JsonCodec<Map<String, String>> codec = JsonCodec.mapJsonCodec(String.class, String.class);\n\n        final Map<String, String> content;\n        try {\n            byte[] bytes = Files.readAllBytes(Paths.get(secretFile));\n            content = codec.fromBytes(bytes);\n        }\n        catch (Exception e) {\n            throw new IllegalArgumentException(\"Could not read secret file \" + secretFile, e);\n        }\n\n        String secret = content.get(\"app-secret\");\n        if (emptyToNull(secret) == null) {\n            throw new IllegalArgumentException(\"app-secret not provided in \" + secretFile);\n        }\n        return secret;\n    }\n\n    public static String mask(String str)\n    {\n        if (str != null && str.length() > MASK_REMAIN) {\n            char[] chars = str.toCharArray();\n            Arrays.fill(chars, 0, chars.length - MASK_REMAIN, '*');\n            return new String(chars);\n        }\n        return str;\n    }\n\n    public static int columnLabelToColumnIndex(String label)\n    {\n        requireNonNull(emptyToNull(label), \"label is null or empty\");\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-lark-sheets/src/main/java/com/facebook/presto/lark/sheets/LarkSheetsUtil.java#L36-L72","documentation":"After successfully reading and decoding the secret file, loadAppSecret looks up the 'app-secret' key. If the value is missing or blank (emptyToNull returns null), it throws IllegalArgumentException('app-secret not provided in <path>'). The file was readable but its content does not contain the required credential key.","triggerScenarios":"Secret file decodes to a map with no 'app-secret' entry, or the entry is an empty/whitespace-only string, when loadAppSecret extracts content.get(\"app-secret\").","commonSituations":"Hand-edited secret file missing the key; key renamed (e.g. 'appSecret' vs 'app-secret'); file regenerated with only the app-id; empty value left after rotating secrets.","solutions":["Add or restore the 'app-secret' key with the real secret value in the secret file.","Ensure the key is spelled exactly 'app-secret' per the codec format the connector expects.","Regenerate the secret file using the connector's supported secret-generation tool/format.","Remove whitespace-only values and re-encode the file."],"exampleFix":"// secret file before\napp-id=cli_a1b2c3\n// after\napp-id=cli_a1b2c3\napp-secret=yourLarkAppSecretValue","handlingStrategy":"validation","validationCode":"byte[] bytes = Files.readAllBytes(Paths.get(secretFile));\nMap<String,String> content = codec.fromBytes(bytes);\nif (content.get(\"app-secret\") == null || content.get(\"app-secret\").isBlank()) {\n    throw new IllegalStateException(\"Secret file missing non-blank 'app-secret' key\");\n}","typeGuard":null,"tryCatchPattern":"try { connector.start(); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"app-secret not provided\")) { // repopulate the 'app-secret' key and restart } else { throw e; } }","preventionTips":["Include both app-id and app-secret keys when generating the file","Use the exact key name 'app-secret'","Validate secret file contents in CI before deploy","Never leave blank values when rotating credentials"],"tags":["config","secret","validation","startup"],"backgroundTag":"missing-config-key","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}