{"record":{"id":"e7421731b4aa3200","repo":"apache/druid","slug":"failed-read-map-from-headers-json","errorCode":null,"errorMessage":"Failed read map from headers json","messagePattern":"Failed read map from headers json","errorType":"exception","errorClass":"ISE","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/catalog/model/table/HttpInputSourceDefn.java","lineNumber":316,"sourceCode":"    if (uris != null) {\n      jsonMap.put(URIS_FIELD, CatalogUtils.stringListToUriList(uris));\n    }\n  }\n\n  /**\n   * URIs in SQL is in the form of a string that contains a comma-delimited\n   * set of URIs. Done since SQL doesn't support array scalars.\n   */\n  private void convertHeaderArg(Map<String, Object> jsonMap, Map<String, Object> args)\n  {\n    String requestHeaders = CatalogUtils.getString(args, HEADERS);\n    Map<String, String> headersMap;\n    if (requestHeaders != null) {\n      try {\n        headersMap = DefaultObjectMapper.INSTANCE.readValue(requestHeaders, new TypeReference<>() {});\n      }\n      catch (JsonProcessingException e) {\n        throw new ISE(\"Failed read map from headers json\");\n      }\n      jsonMap.put(HEADERS_FIELD, headersMap);\n    }\n\n  }\n\n  /**\n   * Convert the user name and password. All are SQL strings. Passwords must be in\n   * the form of a password provider, so do the needed conversion. HTTP provides\n   * two kinds of passwords (plain test an reference to an env var), but at most\n   * one can be provided.\n   */\n  private void convertUserPasswordArgs(Map<String, Object> jsonMap, Map<String, Object> args)\n  {\n    String user = CatalogUtils.getString(args, USER_PARAMETER);\n    if (user != null) {\n      jsonMap.put(USERNAME_FIELD, user);\n    }","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/catalog/model/table/HttpInputSourceDefn.java#L298-L334","documentation":"Thrown by HttpInputSourceDefn.convertHeaderArg when the requestHeaders argument (a JSON string expected to deserialize into Map<String,String>) cannot be parsed by Jackson, wrapping the JsonProcessingException as an IllegalStateException. HTTP tables may attach request headers, and they must be valid JSON object syntax.","triggerScenarios":"convertArgsToSourceMap or convertCompletedTable passes a requestHeaders string to convertHeaderArg and DefaultObjectMapper.readValue throws JsonProcessingException (malformed JSON, wrong shape like an array, or non-string values).","commonSituations":"Users typing header text like 'Authorization: Bearer x' instead of a JSON object; single quotes around keys/values; nested or non-string values; truncated JSON from copy-paste.","solutions":["Supply headers as a valid JSON object string, e.g. \"{\\\"Authorization\\\": \\\"Bearer tok\\\"}\"","Validate the JSON with a parser/JSON tool before submitting","Ensure all values are strings and the top level is an object, not an array"],"exampleFix":"// before\nrequestHeaders = \"Authorization: Bearer tok\"\n// after\nrequestHeaders = \"{\\\"Authorization\\\": \\\"Bearer tok\\\"}\"","handlingStrategy":"validation","validationCode":"try { new ObjectMapper().readTree(headersJson); } catch (Exception e) { throw new IAE(\"headers must be a JSON object\"); }","typeGuard":"boolean isJsonStringObject(String s) { try { return DefaultObjectMapper.INSTANCE.readValue(s, new TypeReference<Map<String,String>>(){}) != null; } catch (Exception e) { return false; } }","tryCatchPattern":"try { convert(headers); } catch (ISE e) { if (e.getMessage().contains(\"headers json\")) { /* show JSON syntax guidance to user */ } else { throw e; } }","preventionTips":["Paste headers as a proper JSON object","Validate JSON before submitting","Avoid hand-typing 'key: value' formats","Keep header values as plain strings"],"tags":["catalog","http","json","headers"],"backgroundTag":"json-parse-error","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}