{"record":{"id":"f5b6c443e7135641","repo":"pentaho/pentaho-kettle","slug":"mappingdialog-exception-notconnectedtorepository-message","errorCode":null,"errorMessage":"MappingDialog.Exception.NotConnectedToRepository.Message","messagePattern":"MappingDialog\\.Exception\\.NotConnectedToRepository\\.Message","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInjectDialog.java","lineNumber":1087,"sourceCode":"    metaInjectMeta.setTargetFile( wTargetFile.getText() );\n    metaInjectMeta.setNoExecution( !wNoExecution.getSelection() );\n\n    final StepMeta streamSourceStep = transMeta.findStep( wStreamingSourceStep.getText() );\n    metaInjectMeta.setStreamSourceStep( streamSourceStep );\n    // PDI-15989 Save streamSourceStepname to find streamSourceStep when loading\n    metaInjectMeta.setStreamSourceStepname( streamSourceStep != null ? streamSourceStep.getName() : \"\" );\n    metaInjectMeta.setStreamTargetStepname( wStreamingTargetStep.getText() );\n\n    metaInjectMeta.setTargetSourceMapping( targetSourceMapping );\n    metaInjectMeta.setChanged( true );\n\n    dispose();\n  }\n\n  private void getByReferenceData( ObjectId transObjectId ) {\n    try {\n      if ( repository == null ) {\n        throw new KettleException( BaseMessages.getString(\n          PKG, \"MappingDialog.Exception.NotConnectedToRepository.Message\" ) );\n      }\n      RepositoryObject transInf = repository.getObjectInformation( transObjectId, RepositoryObjectType.JOB );\n      if ( transInf != null ) {\n        getByReferenceData( transInf );\n      }\n    } catch ( KettleException e ) {\n      new ErrorDialog( shell,\n        BaseMessages.getString( PKG, \"MappingDialog.Exception.UnableToReferenceObjectId.Title\" ),\n        BaseMessages.getString( PKG, \"MappingDialog.Exception.UnableToReferenceObjectId.Message\" ), e );\n    }\n  }\n}\n","sourceCodeStart":1069,"sourceCodeEnd":1101,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInjectDialog.java#L1069-L1101","documentation":"Thrown by MetaInjectDialog.getByReferenceData() when the user asks to load a transformation by reference but no repository is connected (repository == null). Repository.getObjectInformation() cannot be called without a repository, so this guard raises a KettleException with the standard 'not connected to repository' message.","triggerScenarios":"Opening/using the Meta Inject dialog with 'Load from repository by reference' (object id) mode while the transformation was opened from a file (no repository session), or the repository connection was lost.","commonSituations":"Running Spoon with a local/file-based transformation but configuring repository-by-reference injection; repository session timed out before using the By Reference tab; ktr moved between environments losing repository context.","solutions":["Connect to a repository in Spoon (Repository > Connect) before configuring injection by reference","Switch the injection source to 'file' or 'by name' modes if you are not using a repository","Re-login if the repository session expired, then reopen the Meta Inject dialog","Save the transformation into the repository if by-reference configuration is required"],"exampleFix":"// before: configuring by reference without repository\n// Spoon has no repository session\n// after\n// Spoon: Tools > Repository > Connect..., then reopen Meta Inject dialog and pick by reference","handlingStrategy":"validation","validationCode":"// Guard before configuring by-reference injection\nif (repository == null || !repository.isConnected()) {\n  throw new IllegalStateException('Connect to a repository before using By Reference');\n}","typeGuard":"boolean repositoryReady(Repository repo) {\n  try { return repo != null && repo.isConnected(); }\n  catch (Exception e) { return false; }\n}","tryCatchPattern":"try {\n  // getByReference / dialog usage\n} catch (KettleException e) {\n  if (e.getMessage().contains('NotConnectedToRepository')) {\n    log.error('Connect Spoon to a repository, then retry', e);\n  } else throw e;\n}","preventionTips":["Connect to the repository before opening dialogs that need it","Prefer file/name modes when working without a repository","Re-login after long Spoon sessions to avoid expired repo sessions","Keep repository credentials available in CI/production environments"],"tags":["repository","authentication","swing-dialog"],"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"}