Skip to content

Bug: PR #541 fix is incomplete — plugin still requires embedding config #556

@mythpan1

Description

@mythpan1

Bug: PR #541 fix is incomplete — plugin still requires embedding config

Problem

After PR #541 was merged, the plugin still fails to initialize with OpenClaw 2026.4.5 when no embedding API key is provided:

memory-lancedb-pro: embedding: must have required property embedding

Root Cause

PR #541 only updated openclaw.plugin.json (removed top-level required: ["embedding"]), but did NOT update the TypeScript source code that performs the actual runtime validation.

In index.ts, the code explicitly requires config.embedding:

// Line 266
throw new Error("embedding.apiKey is empty");

// Lines 1655–1671 — config.embedding is accessed directly without null checks
config.embedding.model
config.embedding.apiKey
config.embedding.dimensions
config.embedding.baseURL
// ... etc

Additional Context: "Works on my machine" bug

This is likely a classic developer environment bug:

  • The plugin authors had their own embedding API key (Jina / OpenAI) when developing and testing
  • They always had config.embedding populated, so the code path config.embedding.apiKey always worked
  • They never tested the "no embedding config" scenario because they never ran the plugin without one
  • PR fix: remove duplicate memory_compact registration + redundant schema required (OpenClaw 2026.4.5 compat) #541 fixed the Gateway layer validation (openclaw.plugin.json schema — so the gateway no longer says "Unrecognized key"), but the plugin code layer still crashes when config.embedding is undefined

This is two layers of validation:

  1. Gateway layer (plugin.json schema) → PR fix: remove duplicate memory_compact registration + redundant schema required (OpenClaw 2026.4.5 compat) #541 fixed this ✅
  2. Plugin code layer (index.ts runtime) → NOT fixed ❌

Users relying on local embedding (Ollama, etc.) without external API keys will hit the plugin code crash, while developers with API keys never noticed.

Expected Behavior

The plugin should initialize with plugins.entries.memory-lancedb-pro: { enabled: true } and gracefully handle the absence of an embedding config — either falling back to memory-core builtin embedding or skipping vector search.

Actual Behavior

The plugin throws at initialization:

Error: embedding.apiKey is empty

Because config.embedding is undefined when only { enabled: true } is provided.

Suggested Fix

In index.ts, make embedding truly optional:

// Change Line 266 — make it a warning, not a throw
if (!config.embedding?.apiKey) {
  // fallback: use memory-core builtin embedding or skip
}

// Add optional chaining throughout (lines 1655–1671)
config.embedding?.model
config.embedding?.apiKey
config.embedding?.dimensions
// etc.

Environment

  • OpenClaw: v2026.4.5 (3e72c03)
  • Plugin: v1.1.0-beta.10 (latest master, commit 902ada3)
  • macOS, Node v25
  • Embedding: local Ollama (no external API key)

Config

{
  "plugins": {
    "entries": {
      "memory-lancedb-pro": {
        "enabled": true
      }
    }
  }
}

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions