{"record":{"id":"9432dab74fd77be0","repo":"pentaho/pentaho-kettle","slug":"connectionfilenameparser-connectionnameinvalidcharacter","errorCode":"ConnectionFileNameParser.ConnectionNameInvalidCharacter","errorMessage":"ConnectionFileNameParser.ConnectionNameInvalidCharacter","messagePattern":"ConnectionFileNameParser\\.ConnectionNameInvalidCharacter","errorType":"error_code","errorClass":"KettleVFSFileSystemException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/connections/vfs/provider/ConnectionFileNameParser.java","lineNumber":164,"sourceCode":"      instance = new ConnectionFileNameParser();\n    }\n\n    return instance;\n  }\n\n  @NonNull\n  protected ConnectionFileNameUtils getConnectionFileNameUtils() {\n    return connectionFileNameUtils;\n  }\n\n  public void validateConnectionName( @Nullable String connectionName ) throws FileSystemException {\n    if ( StringUtils.isEmpty( connectionName ) ) {\n      throw new KettleVFSFileSystemException( \"ConnectionFileNameParser.ConnectionNameEmpty\" );\n    }\n\n    for ( char c : connectionName.toCharArray() ) {\n      if ( !isValidConnectionNameCharacter( c ) ) {\n        throw new KettleVFSFileSystemException(\n          \"ConnectionFileNameParser.ConnectionNameInvalidCharacter\",\n          connectionName,\n          c );\n      }\n    }\n  }\n\n  /**\n   * Determines if a given character is a valid in a connection name.\n   *\n   * @param c The character to test.\n   * @return {@code true} if the character is valid; {@code false}, otherwise.\n   */\n  public boolean isValidConnectionNameCharacter( char c ) {\n    return CONNECTION_NAME_INVALID_CHARACTERS.indexOf( c ) < 0;\n  }\n\n  /**","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/connections/vfs/provider/ConnectionFileNameParser.java#L146-L182","documentation":"validateConnectionName also enforces that each character in a connection name is a valid connection name character (isValidConnectionNameCharacter). Names containing illegal characters (e.g. '/', ':', spaces, or other reserved/unsafe characters) throw KettleVFSFileSystemException with code 'ConnectionFileNameParser.ConnectionNameInvalidCharacter', since such characters would corrupt the pvfs:// URI structure.","triggerScenarios":"Parsing or validating a connection name containing any character not accepted by isValidConnectionNameCharacter — e.g. 'pvfs://my conn', 'pvfs://a/b' where 'a/b' is treated as the name, or names with ':', '?', '#'.","commonSituations":"Users embedding slashes or spaces in connection names; file-system paths pasted wholesale as the connection name; auto-generated names from file paths or URLs.","solutions":["Sanitize the connection name to allowed characters (alphanumerics, dashes, underscores — check isValidConnectionNameCharacter for the exact set).","Validate the name with parser.validateConnectionName(name) before registering or embedding it in a URI.","Move any path structure into the path portion of the URI, not the connection segment.","Escape or rename sources of auto-generated names (e.g. derive name from a file name but strip illegal chars)."],"exampleFix":"// before\nString name = \"my conn/2024\";\nparser.validateConnectionName( name ); // throws\n// after\nString name = \"my-conn-2024\";\nparser.validateConnectionName( name ); // ok","handlingStrategy":"validation","validationCode":"for ( char c : connectionName.toCharArray() ) {\n  if ( !Character.isLetterOrDigit( c ) && c != '-' && c != '_' ) {\n    throw new IllegalArgumentException( \"Illegal character in connection name: \" + c );\n  }\n}","typeGuard":"null","tryCatchPattern":"try {\n  parser.validateConnectionName( connectionName );\n} catch ( FileSystemException e ) {\n  // sanitize the name and retry\n}","preventionTips":["Sanitize auto-generated names (strip '/', ':', spaces) before use","Keep path parts in the URI path, never in the connection segment","Validate names at connection-registration time, not only at parse time"],"tags":["vfs","uri-parsing","identifier-validation"],"backgroundTag":"invalid-identifier-format","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"}