{"record":{"id":"cfd946b1e70f2052","repo":"pentaho/pentaho-kettle","slug":"browser-session-authentication-requested-but-no-jsessionid","errorCode":null,"errorMessage":"Browser session authentication requested but no JSESSIONID found","messagePattern":"Browser session authentication requested but no JSESSIONID found","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepositoryConnector.java","lineNumber":182,"sourceCode":"   * @throws KettleException if no valid JSESSIONID can be found\n   */\n  private void resolveSessionId() throws KettleException {\n    String jsessionId = null;\n    try {\n      AuthenticationContext authContext =\n        SpoonSessionManager.getInstance()\n          .getAuthenticationContext( repositoryMeta.getRepositoryLocation().getUrl() );\n      if ( authContext != null && authContext.isAuthenticated() ) {\n        jsessionId = authContext.getJSessionId();\n      }\n    } catch ( Exception e ) {\n      log.logError( \"Error retrieving JSESSIONID from SpoonSessionManager\", e );\n    }\n\n    if ( jsessionId != null && !jsessionId.trim().isEmpty() ) {\n      log.logBasic( \"Using browser-captured JSESSIONID for authentication\" );\n    } else {\n      throw new KettleException( \"Browser session authentication requested but no JSESSIONID found\" );\n    }\n  }\n\n  /**\n   * Attempts an in-process connection via PentahoSystem when the BI Platform context is available.\n   *\n   * @return a completed {@link RepositoryConnectResult} if in-process connection succeeded, {@code null} otherwise\n   */\n  private RepositoryConnectResult tryInProcessConnect( final String decryptedPassword,\n      final RepositoryConnectResult result ) {\n    if ( PentahoSystem.getApplicationContext() == null || PentahoSessionHolder.getSession() == null\n        || !PentahoSessionHolder.getSession().isAuthenticated() || !inProcess() ) {\n      return null;\n    }\n\n    result.setUnifiedRepository( PentahoSystem.get( IUnifiedRepository.class ) );\n    if ( result.getUnifiedRepository() == null ) {\n      return null;","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepositoryConnector.java#L164-L200","documentation":"When the connection is configured to authenticate using the browser-captured session cookie, connect() looks up JSESSIONID from the SpoonSessionManager. If the lookup yields null/empty, resolveSessionId throws this KettleException because browser-session authentication cannot proceed without the cookie.","triggerScenarios":"Authentication mode set to browser/session-cookie while resolveSessionId finds no JSESSIONID in the SpoonSessionManager (missing, null, or whitespace-only), or the session retrieval itself logged an error.","commonSituations":"Running Spoon via a non-browser launch path so no JSESSIONID was captured; browser session expired before connect; misconfigured repository dialog selecting session auth when a username/password was intended.","solutions":["Log into the Pentaho web UI first so a fresh JSESSIONID is captured in the Spoon session","Switch the repository connection to explicit username/password authentication instead of session-cookie auth","Clear/refresh the captured session data and retry (re-launch Spoon with the browser flow)","If scripting headless, do not use browser-session auth — provide credentials directly"],"exampleFix":"// before\nrepoMeta.setBrowserBasedAuthentication(true); // but no JSESSIONID present\n// after\nString sid = SpoonSessionManager.get(...).getJsessionId();\nif (sid != null && !sid.trim().isEmpty()) {\n  repoMeta.setBrowserBasedAuthentication(true);\n} else {\n  repoMeta.setBrowserBasedAuthentication(false); // fall back to credentials\n}","handlingStrategy":"validation","validationCode":"String sid = (String) SpoonSessionManager.getInstance().get(\"jsessionid\"); // adjust to actual API\nif (sid == null || sid.trim().isEmpty()) {\n  throw new KettleException(\"No JSESSIONID captured; log into the Pentaho web UI first or use credential auth\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  repository.connect(repoMeta);\n} catch (KettleException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"JSESSIONID\")) {\n    // fall back to username/password authentication\n  } else throw e;\n}","preventionTips":["Prefer explicit username/password auth in headless/CI environments","Confirm an active browser session exists before choosing session-cookie auth","Handle expired sessions by re-authenticating and refreshing the cookie"],"tags":["kettle","pentaho","authentication","jsessionid","session"],"backgroundTag":"authentication-required","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}