immich-app/immich · error · Error

Calling host functions is not allowed without setting method

Error message

Calling host functions is not allowed without setting methods[].hostFunctions=true in the plugin manifest

What it means

A plain Error (not an HttpException) thrown by the dummy() stub used when a plugin WASM module calls a host function but the plugin was loaded with the stub function set because methods[].hostFunctions was not set to true in its manifest. The plugin loader in onPluginLoad loads plugins twice: once with stubs (hostFunctions=false) and once with real functions (hostFunctions=true); calling a real host function on the stub-loaded instance throws this.

Source

Thrown at server/src/services/workflow-execution.service.ts:33

import { PluginManifestDto } from 'src/dtos/plugin-manifest.dto';
import {
  BootstrapEventPriority,
  DatabaseLock,
  ImmichEnvironment,
  ImmichWorker,
  JobName,
  JobStatus,
  QueueName,
  WorkflowType,
} from 'src/enum';
import { ArgOf } from 'src/repositories/event.repository';
import { AlbumService } from 'src/services/album.service';
import { AssetService } from 'src/services/asset.service';
import { BaseService } from 'src/services/base.service';
import { JobOf } from 'src/types';

const dummy = () => {
  throw new Error(
    `Calling host functions is not allowed without setting methods[].hostFunctions=true in the plugin manifest`,
  );
};

type ExecuteOptions<T extends WorkflowType> = {
  read: (type: T) => Promise<{ authUserId: string; data: WorkflowEventData<T> }>;
  write: (auth: AuthDto, changes: WorkflowChanges<T>) => Promise<void>;
};

type AssetTrigger = { userId: string; assetId: string; trigger: WorkflowTrigger };

type HostContext = {
  allowedHosts: string[];
};

export class WorkflowExecutionService extends BaseService {
  private jwtSecret!: string;

View on GitHub (pinned to 199723261c)

Solutions

  1. Edit the plugin's manifest.json and set hostFunctions:true on every method that calls host functions, then re-import the plugin.
  2. Confirm the plugin is being re-imported after the manifest change (restart microservices or change the hash to force re-import).
  3. Ensure the method only needs host functions when truly required; otherwise remove the host function call.
  4. Verify the manifest validates against PluginManifestDto.schema after the edit.

Example fix

// before (manifest.json)
{ "methods": [{ "name": "tagImage", "type": "asset.v1" }] }

// after
{ "methods": [{ "name": "tagImage", "type": "asset.v1", "hostFunctions": true }] }
Defensive patterns

Strategy: validation

Validate before calling

// Plugin authoring-time validation of the manifest before import
const needsHostFunctions = (wasm) => Boolean(wasm.callsHostFunction); // per plugin SDK analysis
for (const m of manifest.methods) {
  if (needsHostFunctions(m) && !m.hostFunctions) {
    throw new Error(`Method ${m.name} calls host functions but hostFunctions is not true`);
  }
}

Type guard

const isHostFunctionManifestError = (e: unknown): boolean =>
  typeof e === 'object' && e !== null && typeof (e as any).message === 'string' &&
  (e as any).message.includes('hostFunctions=true');

Try / catch

// This error occurs inside the plugin runtime; catch it at the workflow run level
try {
  await runWorkflow(workflowId);
} catch (e) {
  if (isHostFunctionManifestError(e)) {
    logger.error('Plugin manifest missing hostFunctions:true; update manifest and re-import');
  }
}

Prevention

When it happens

Trigger: A plugin's WASM code invokes httpRequest, searchAlbums, createAlbum, etc., but the plugin manifest declares the method without hostFunctions=true, so only the stub instance is loaded. The error surfaces inside the Extism plugin call and is caught by the execute() try/catch, failing the workflow run.

Common situations: Plugin author forgot to set hostFunctions:true in the manifest for a method that calls host functions; method was refactored to use host functions without updating the manifest; manifest schema drift between SDK and server versions.

Related errors


AI-assisted analysis of immich-app/immich@199723261c (2026-08-12). Data as JSON: /api/errors/71dd48a71bc5944e. Report an issue: GitHub.