{"record":{"id":"dd3ca32e76bf0329","repo":"kestra-io/kestra","slug":"digest-authentication-requires-an-absolute-uri-wit","errorCode":null,"errorMessage":"Digest authentication requires an absolute URI with a host.","messagePattern":"Digest authentication requires an absolute URI with a host\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/http/client/HttpClient.java","lineNumber":483,"sourceCode":"        if (eventConsumer != null) {\n            eventConsumer.accept(event);\n        }\n    }\n\n    private HttpClientContext clientContext(HttpRequest request) throws IllegalVariableEvaluationException {\n        HttpClientContext httpClientContext = ContextBuilder.create().build();\n\n        if (this.configuration.getAuth() instanceof DigestAuthConfiguration digestAuthConfiguration) {\n            String username = runContext.render(digestAuthConfiguration.getUsername()).as(String.class).orElse(null);\n            String password = runContext.render(digestAuthConfiguration.getPassword()).as(String.class).orElse(null);\n\n            if (StringUtils.isEmpty(username) || password == null) {\n                throw new IllegalArgumentException(\"Digest authentication requires both `username` and `password`.\");\n            }\n\n            URI uri = request.getUri();\n            if (uri == null || uri.getHost() == null) {\n                throw new IllegalArgumentException(\"Digest authentication requires an absolute URI with a host.\");\n            }\n\n            int port = uri.getPort() != -1 ? uri.getPort() : (\"https\".equalsIgnoreCase(uri.getScheme()) ? 443 : 80);\n            AuthScope digestScope = new AuthScope(uri.getHost(), port);\n            UsernamePasswordCredentials digestCredentials = new UsernamePasswordCredentials(username, password.toCharArray());\n\n            httpClientContext.setCredentialsProvider((authScope, context) ->\n            {\n                if (digestScope.match(authScope) >= 0) {\n                    return digestCredentials;\n                }\n                return this.defaultCredentialsProvider.getCredentials(authScope, context);\n            });\n        }\n\n        return httpClientContext;\n    }\n","sourceCodeStart":465,"sourceCodeEnd":501,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/http/client/HttpClient.java#L465-L501","documentation":"Thrown by the Kestra HTTP client when digest authentication is configured but the request URI lacks a host. Digest auth needs an absolute URI to build the AuthScope (host + port); if request.getUri() is null or its host is null, IllegalArgumentException is thrown. Note: this fires only after the credential guard passes.","triggerScenarios":"Digest auth configured; username/password both present; request.getUri() returns null OR uri.getHost() is null; the guard throws IllegalArgumentException.","commonSituations":"URI is relative (e.g. '/api/x') instead of absolute, the URI scheme/host is built from an expression that rendered empty, a malformed URI string, or the base URL was not set for a templated request.","solutions":["Use an absolute URI with a scheme and host (https://example.com/path).","If the URI is templated, ensure the rendered expression yields a full URL.","Set a base URI on the request/task if the path is relative.","Validate the rendered URI in a debug step before the HTTP call."],"exampleFix":"# before (relative URI)\nuri: \"/api/v1/users\"\n# after (absolute URI)\nuri: \"https://example.com/api/v1/users\"","handlingStrategy":"validation","validationCode":"URI uri = request.getUri();\nif (uri == null || uri.getHost() == null) {\n  throw new IllegalStateException('Digest auth requires an absolute URI with a host');\n}","typeGuard":null,"tryCatchPattern":"try {\n  // build AuthScope from uri host/port\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains('absolute URI')) {\n    log.error('Configure an absolute URI for digest-auth requests');\n  }\n  throw e;\n}","preventionTips":["Use absolute URIs (scheme + host) for digest-auth requests.","Validate templated URIs render to full URLs.","Set a base URI when the path is relative."],"tags":["http-client","auth","digest","uri","configuration"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}