{"record":{"id":"7b25e4c1de6bcf44","repo":"pentaho/pentaho-kettle","slug":"could-not-execute-friendlymetatype-specified-in-a-repository","errorCode":null,"errorMessage":"Could not execute <friendlyMetaType> specified in a repository since we're not connected to one","messagePattern":"Could not execute <friendlyMetaType> specified in a repository since we're not connected to one","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/base/MetaFileLoaderImpl.java","lineNumber":264,"sourceCode":"            } else {\n              throw new KettleException( BaseMessages.getString( persistentClass,\n                \"JobJob.Exception.ReferencedTransformationIdIsNull\" ) );\n            }\n          }\n\n          if ( rep != null ) {\n            theMeta = attemptCacheRead( metaObjectId.toString() ); //try to get from the cache first\n            if ( theMeta == null ) {\n              // Load the last revision\n              if ( isTransMeta() ) {\n                theMeta = (T) rep.loadTransformation( metaObjectId, null );\n              } else {\n                theMeta = (T) rep.loadJob( metaObjectId, null );\n              }\n              idContainer[ 0 ] = metaObjectId.toString();\n            }\n          } else {\n            throw new KettleException(\n              \"Could not execute \" + friendlyMetaType + \" specified in a repository since we're not connected to one\" );\n          }\n          break;\n        default:\n          throw new KettleException( \"The specified object location specification method '\"\n            + specificationMethod + \"' is not yet supported in this \" + friendlyMetaType + \" entry.\" );\n      }\n\n      cacheMeta( idContainer[ 0 ], theMeta );\n      // Re-seed the internal directory variables on the returned meta from the freshly resolved tmpSpace.\n      // The cache may return an instance whose internal vars were last set in a different context\n      // (e.g. from a step loader using getVarSpaceOnlyWithRequiredParentVars, or with rep==null),\n      // which would otherwise leak the wrong Internal.Entry.Current.Directory into the child execution.\n      reseedInternalDirectoryVars( theMeta, tmpSpace );\n      return theMeta;\n    } catch ( final KettleException ke ) {\n      // if we get a KettleException, simply re-throw it\n      throw ke;","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/base/MetaFileLoaderImpl.java#L246-L282","documentation":"The job entry says its object lives in a repository (specificationMethod = REPOSITORY_BY_REFERENCE, or by-name repo resolution reaching the load step), but the Repository handle passed to getMetaForEntry is null — the process is not connected to a repository. Kettle throws a KettleException stating it cannot execute the <transformation/job> specified in a repository without an active repository connection.","triggerScenarios":"Executing a job (locally, via Kitchen, Java API, or tests) where the entry's specificationMethod is REPOSITORY_BY_REFERENCE but getMetaForEntry receives rep == null — e.g. running a job metadata object outside a repository context, a failed/not-performed repository login, or passing null as the Repository argument to Job.execute/JobMeta loaders.","commonSituations":"Running Kitchen/Pan with a repo-defined job but without -rep/-user/-pass connection parameters; unit tests constructing JobMeta without a Repository; a KettleDatabaseRepository login that failed silently; scheduling environments where the repository connection was dropped before execution.","solutions":["Connect to the repository before running: supply -rep <repoName> -user <user> -pass <password> to Kitchen/Pan, or pass a connected Repository object in the Java API.","If the entry should not depend on a repository, change its specificationMethod to FILENAME and point it at the ktr/kjb file path.","Verify repository login succeeded (check rep.isConnected()) before Job.execute() and fail fast with a clear message.","For tests, mock/stub a Repository or switch the entry to REPOSITORY_BY_NAME/FILENAME modes that have non-repo fallbacks."],"exampleFix":"// before (Java API)\nJob job = new Job( null, jobMeta ); // rep == null, entry is REPOSITORY_BY_REFERENCE\n\n// after\nKettleEnvironment.init();\nRepositoriesMeta reposMeta = new RepositoriesMeta();\nreposMeta.readData();\nRepository rep = KettleDatabaseRepository.findRepository( reposMeta, \"repo1\" );\nrep.connect( \"admin\", \"admin\" );\nJob job = new Job( null, jobMeta, rep ); // connected repository supplied","handlingStrategy":"try-catch","validationCode":"// fail fast before execution if the entry needs a repository\nif ( jobEntry.getSpecificationMethod() == SPECIFICATION_METHOD.REPOSITORY_BY_REFERENCE\n     && ( rep == null || !rep.isConnected() ) ) {\n  throw new IllegalStateException( \"Not connected to a repository but entry requires one\" );\n}","typeGuard":"boolean repositoryAvailable( Repository rep ) {\n  return rep != null && rep.isConnected();\n}","tryCatchPattern":"try {\n  meta = loader.getMetaForEntry( bowl, rep, metaStore, space );\n} catch ( KettleException ke ) {\n  if ( String.valueOf( ke.getMessage() ).contains( \"not connected to\" ) ) {\n    rep = connectRepository( repoName, user, password ); // reconnect then retry once\n    meta = loader.getMetaForEntry( bowl, rep, metaStore, space );\n  } else {\n    throw ke;\n  }\n}","preventionTips":["Always pass -rep/-user/-pass to Kitchen/Pan when running repository-defined jobs.","Check rep.isConnected() as a precondition of job execution in schedulers.","Handle repository login failures explicitly instead of continuing with a null Repository.","For standalone runs, switch entries to FILENAME mode so no repository is needed."],"tags":["kettle","repository","connection","job-entry","configuration"],"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"}