{"record":{"id":"0fe304cc5957afe5","repo":"pentaho/pentaho-kettle","slug":"name-undefined","errorCode":null,"errorMessage":"${name} undefined","messagePattern":"(.+?) undefined","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/version/EnvironmentVariableGetter.java","lineNumber":21,"sourceCode":" * Pentaho\n *\n * Copyright (C) 2024 - 2026 by Pentaho Canada Inc. : http://www.pentaho.com\n *\n * Use of this software is governed by the Business Source License included\n * in the LICENSE.TXT file.\n *\n * Change Date: 2030-06-15\n ******************************************************************************/\n\n\n\npackage org.pentaho.di.version;\n\npublic class EnvironmentVariableGetter {\n  public String getEnvVarible( String name ) throws Exception {\n    String result = System.getenv( name );\n    if ( result == null ) {\n      throw new RuntimeException( name + \" undefined\" );\n    }\n    return result;\n  }\n}\n","sourceCodeStart":3,"sourceCodeEnd":26,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/version/EnvironmentVariableGetter.java#L3-L26","documentation":"EnvironmentVariableGetter.getEnvVarible reads an environment variable with System.getenv and throws RuntimeException '<name> undefined' when the variable is not present in the process environment. It is a strict accessor that treats a missing env var as a hard failure.","triggerScenarios":"Calling getEnvVarible(name) where System.getenv(name) returns null — the variable was never set, was unset before the process started, or its name is misspelled/case-mismatched.","commonSituations":"Running the app locally without the CI/build environment variables set (e.g. build-version related vars); Docker/Kubernetes containers missing an env entry; case sensitivity differences between Windows and Linux.","solutions":["Set the required environment variable before launching the JVM (export NAME=value or container env config).","Fix the variable name spelling/case in the calling code to match what is defined.","If the variable is optional, read System.getenv directly and handle null instead of using this strict getter.","Add the variable to the deployment/runtime configuration so all environments define it."],"exampleFix":"// before\nString v = new EnvironmentVariableGetter().getEnvVarible( \"BUILD_NUMBER\" );\n// after\nString v = System.getenv( \"BUILD_NUMBER\" );\nif ( v == null ) { v = \"0\"; } // or fail with a clear message\n","handlingStrategy":"validation","validationCode":"String v = System.getenv( name );\nif ( v == null ) { v = defaultValue; } // or abort with a clear config error before calling the getter","typeGuard":"Optional<String> envOrEmpty( String name ) {\n  return Optional.ofNullable( System.getenv( name ) );\n}","tryCatchPattern":"try {\n  String v = new EnvironmentVariableGetter().getEnvVarible( name );\n} catch ( RuntimeException e ) {\n  log.error( \"Required environment variable missing: \" + name );\n}","preventionTips":["Document required env vars and fail fast at startup with a checklist","Match variable names/case exactly across platforms","Provide defaults for optional variables instead of using the strict getter"],"tags":["missing-env-var","environment","java"],"backgroundTag":"missing-env-var","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"}