pentaho/pentaho-kettle · error · KettleException

MappingDialog.Exception.NotConnectedToRepository.Message

Error message

MappingDialog.Exception.NotConnectedToRepository.Message

What it means

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.

Solutions

  1. Connect to a repository in Spoon (Repository > Connect) before configuring injection by reference
  2. Switch the injection source to 'file' or 'by name' modes if you are not using a repository
  3. Re-login if the repository session expired, then reopen the Meta Inject dialog
  4. Save the transformation into the repository if by-reference configuration is required

Example fix

// before: configuring by reference without repository
// Spoon has no repository session
// after
// Spoon: Tools > Repository > Connect..., then reopen Meta Inject dialog and pick by reference
Defensive patterns

Strategy: validation

Validate before calling

// Guard before configuring by-reference injection
if (repository == null || !repository.isConnected()) {
  throw new IllegalStateException('Connect to a repository before using By Reference');
}

Type guard

boolean repositoryReady(Repository repo) {
  try { return repo != null && repo.isConnected(); }
  catch (Exception e) { return false; }
}

Try / catch

try {
  // getByReference / dialog usage
} catch (KettleException e) {
  if (e.getMessage().contains('NotConnectedToRepository')) {
    log.error('Connect Spoon to a repository, then retry', e);
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/f5b6c443e7135641. Report an issue: GitHub.

Appendix: source

Thrown at plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInjectDialog.java:1087

    metaInjectMeta.setTargetFile( wTargetFile.getText() );
    metaInjectMeta.setNoExecution( !wNoExecution.getSelection() );

    final StepMeta streamSourceStep = transMeta.findStep( wStreamingSourceStep.getText() );
    metaInjectMeta.setStreamSourceStep( streamSourceStep );
    // PDI-15989 Save streamSourceStepname to find streamSourceStep when loading
    metaInjectMeta.setStreamSourceStepname( streamSourceStep != null ? streamSourceStep.getName() : "" );
    metaInjectMeta.setStreamTargetStepname( wStreamingTargetStep.getText() );

    metaInjectMeta.setTargetSourceMapping( targetSourceMapping );
    metaInjectMeta.setChanged( true );

    dispose();
  }

  private void getByReferenceData( ObjectId transObjectId ) {
    try {
      if ( repository == null ) {
        throw new KettleException( BaseMessages.getString(
          PKG, "MappingDialog.Exception.NotConnectedToRepository.Message" ) );
      }
      RepositoryObject transInf = repository.getObjectInformation( transObjectId, RepositoryObjectType.JOB );
      if ( transInf != null ) {
        getByReferenceData( transInf );
      }
    } catch ( KettleException e ) {
      new ErrorDialog( shell,
        BaseMessages.getString( PKG, "MappingDialog.Exception.UnableToReferenceObjectId.Title" ),
        BaseMessages.getString( PKG, "MappingDialog.Exception.UnableToReferenceObjectId.Message" ), e );
    }
  }
}

View on GitHub (pinned to f3058517a1)