Skip to content

GitHub Issue: TypeError - stringEnum is not a function (SDK Incompatibility) #392

@bughunt8

Description

@bughunt8

Plugin Version

v1.1.0-beta.6, v1.0.9

OpenClaw Version

2026.3.24

Bug Description

The memory-lancedb-pro plugin fails to register properly with OpenClaw 2026.3.24 due to an SDK incompatibility. The plugin attempts to import stringEnum from openclaw/plugin-sdk, but this function is not exported by the SDK.

This causes:

  1. Continuous plugin registration failures
  2. Excessive plugin reload attempts (130+ per hour)
  3. Memory leak (each failed load consumes memory)
  4. Heap exhaustion (reached 92% usage before fix)
  5. Gateway crashes due to OOM errors

.


🛠️ Proposed Fix

Replace stringEnum with TypeBox Type.Union of Type.Literal values:

Before (broken):

import { stringEnum } from "openclaw/plugin-sdk";

export const MEMORY_CATEGORIES = ["preference", "fact", "decision", "entity", "other"] as const;

// Usage:
category: Type.Optional(stringEnum(MEMORY_CATEGORIES))

After (working):

// Remove stringEnum import
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";

export const MEMORY_CATEGORIES = ["preference", "fact", "decision", "entity", "other"] as const;

// Add TypeBox Union schema
export const MemoryCategorySchema = Type.Union([
  Type.Literal("preference"),
  Type.Literal("fact"),
  Type.Literal("decision"),
  Type.Literal("entity"),
  Type.Literal("other")
]);

// Usage (replace all 4 occurrences):
category: Type.Optional(MemoryCategorySchema)

✅ Test Results

Before Patch:

Plugin Errors:       Continuous (stringEnum failures)
Plugin Loads:        130/hour (retry loop)
Memory Usage:        3781 MB (92% of 4GB)
Gateway Stability:   CRITICAL (crashes every 2-4 hours)

After Patch:

Plugin Errors:       0 (zero)
Plugin Loads:        4/hour (normal)
Memory Usage:        1040 MB (17% of 6GB)
Gateway Stability:   GOOD (stable for 24+ hours)

Expected Behavior

✅ Expected Behavior

Plugin should:

  • Import stringEnum successfully from SDK
  • Register once at startup
  • Provide memory management tools
  • Maintain stable memory usage

❌ Actual Behavior

Plugin fails with:

TypeError: (0 , _pluginSdk.stringEnum) is not a function

Observed behavior:

  • Plugin attempts to register repeatedly (130+ times/hour)
  • Each attempt fails with TypeError
  • Memory accumulates with each failed attempt
  • Gateway eventually crashes with OOM error

Steps to Reproduce

🔄 Steps to Reproduce

  1. Install OpenClaw 2026.3.24
  2. Install memory-lancedb-pro plugin (v1.0.9 or v1.1.0-beta.6)
  3. Configure plugin in openclaw.json:
{
  "plugins": {
    "entries": {
      "memory-lancedb-pro": {
        "enabled": true,
        "config": {
          "embedding": {
            "provider": "openai-compatible",
            "model": "mxbai-embed-large",
            "baseURL": "http://ollama1:11434/v1",
            "dimensions": 1024
          }
        }
      }
    }
  }
}
  1. Start OpenClaw Gateway
  2. Observe logs for plugin registration errors

Error Logs / Screenshots

### Error Logs


Mar 28 22:38:12 gateway[2233606]: [plugins] memory-lancedb-pro@1.0.9: plugin registered
Mar 28 22:38:12 gateway[2233606]: [plugins] memory-lancedb-pro failed during register: TypeError: (0 , _pluginSdk.stringEnum) is not a function


### Memory Impact


Before Plugin:     ~800 MB heap usage
With Plugin Error: ~3800 MB heap usage (92% of 4GB limit)
Crash Threshold:   4096 MB heap limit

Embedding Provider

Ollama

OS / Platform

OS: Linux 6.12.63+deb13-amd64 (x64); Node.js: v24.13.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions