#lobster workflow failing

1 messages · Page 1 of 1 (latest)

severe minnow
#

I'm running a lobster worklflow, the invoke llm script is failing with this error

llm-task args: {
"provider": "lmstudio",
"model": "lmstudio/qwen3.6-35b-a3b-mtp",
"timeoutMs": 1800000,
"maxTokens": 32000,
"temperature": 0,
"requestTimeoutMs": 2100000
}
Gateway HTTP request failed
URL: http://127.0.0.1:18789/tools/invoke
Status: 401 Unauthorized
Raw response:
{"error":{"message":"Unauthorized","type":"unauthorized"}}

alpine nymphBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> âś… Mark Solution

pulsar meteorBOT
fickle badgerBOT
# severe minnow I'm running a lobster worklflow, the invoke llm script is failing with this erro...

That 401 is coming from the OpenClaw Gateway, before it ever reaches LM Studio. So this is almost certainly not the lmstudio/qwen... model config; the workflow’s /tools/invoke request is missing the gateway shared-secret auth, or using the wrong one.

First, please include your version so we don’t chase old behavior:

openclaw --version

Quick checks on the gateway host:

openclaw gateway status
openclaw config get gateway.auth.mode
openclaw config get gateway.auth.token

Do not paste the token here. The script calling:

fickle badgerBOT
fickle badgerBOT
# severe minnow I'm running a lobster worklflow, the invoke llm script is failing with this erro...

Then make sure the workflow process has the same secret available, commonly via:

export OPENCLAW_GATEWAY_TOKEN="$(openclaw config get gateway.auth.token)"

and that the invoke script actually maps it into the HTTP Authorization header. If you’re using password mode instead, same idea but with OPENCLAW_GATEWAY_PASSWORD.

Relevant docs:
https://docs.openclaw.ai/gateway/configuration
https://docs.openclaw.ai/gateway/troubleshooting
https://docs.openclaw.ai/web/dashboard

severe minnow
fickle badgerBOT
# severe minnow Script can be found here https://cl1p.net/4561

I checked the script. It already sends:

if (token) headers.authorization = `Bearer ${token}`;

So the 401 means token is empty or doesn’t match what the gateway expects.

In your script, token only comes from:

process.env.OPENCLAW_GATEWAY_TOKEN || process.env.SHARED_GATEWAY_TOKEN || ""

So fix depends on your gateway auth mode:

fickle badgerBOT
# severe minnow Script can be found here https://cl1p.net/4561
openclaw --version
openclaw config get gateway.auth.mode
openclaw config get gateway.auth.token

Don’t paste the token here. If gateway.auth.mode is token, run the workflow from a shell that has:

export OPENCLAW_GATEWAY_TOKEN="$(openclaw config get gateway.auth.token)"

If your gateway is using password auth, the script currently does not read OPENCLAW_GATEWAY_PASSWORD. Change this line:

const token = process.env.OPENCLAW_GATEWAY_TOKEN || process.env.SHARED_GATEWAY_TOKEN || "";
fickle badgerBOT
severe minnow
#

I'm seeing these errors in the openclaw log

22:19:43
warn
tools-invoke
tool execution failed: Error: LLM JSON did not match schema: leads.0.contact: must be string; leads.1.contact: must be string; leads.2.contact: must be string; leads.3.contact: must be string; leads.4.contact: must be string
22:19:43
error
[tools] lobster failed: workflow command failed (1): sh -c 'node /home/admin/.openclaw/workspace-dba-scout/lobster-scripts/invoke-llm-task.js 2> /home/admin/.openclaw/workspace-dba-scout/debug-draft-email-stderr.txt' raw_params={"action":"run","pipeline":"/home/admin/.openclaw/workspace-dba-scout/sql-leads-draft.lobster","timeoutMs":1800000,"maxStdoutBytes":512000}
22:19:43
error
[tools] lobster failed: workflow command failed (1): sh -c 'node /home/admin/.openclaw/workspace-dba-scout/lobster-scripts/invoke-llm-task.js 2> /home/admin/.openclaw/workspace-dba-scout/debug-draft-email-stderr.txt' raw_params={"action":"run","pipeline":"/home/admin/.openclaw/workspace-dba-scout/sql-leads-draft.lobster","timeoutMs":1800000,"maxStdoutBytes":512000}

fickle badgerBOT
# severe minnow I'm seeing these errors in the openclaw log 22:19:43 warn tools-invoke tool exe...

Good, that means the gateway auth problem is past this step. This new failure is inside the llm-task schema validation.

The model returned JSON, but the workflow schema says each lead must have:

"contact": "some string"

and the model likely returned something like:

"contact": { "email": "...", "phone": "..." }

or null / an array. The validator is rejecting all 5 leads because contact is not a string.

Smallest fixes:

fickle badgerBOT
# severe minnow I'm seeing these errors in the openclaw log 22:19:43 warn tools-invoke tool exe...
  1. Inspect the actual model output if your script captured it, especially:
cat /home/admin/.openclaw/workspace-dba-scout/debug-draft-email-stderr.txt
  1. In sql-leads-draft.lobster, either change the schema so contact matches what you actually want, or tighten the prompt to require a string. For example:
For each lead, contact must be a single string. If no contact is available, use "".
Do not return an object, array, or null for contact.
  1. If using Qwen/LM Studio for JSON, I’d also add a cleanup rule in the script/workflow before validation: convert missing/null/object contact values into a string. Local models often drift on nested JSON schemas.

So: 401 Unauthorized was gateway auth. This one is output shape/schema mismatch. Different layer.

severe minnow
fickle badgerBOT
# severe minnow This is the active.md file https://cl1p.net/4562

Yep, that active.md explains the validation error.

Each lead’s Contact section is multi-line structured Markdown, for example:

- **Contact:**
  - Nigel Muirhead — CEO
  - LinkedIn: ...
  - Email pattern: ...
  - Fiona Phillips — Chief People Officer
  - LinkedIn: ...

Your workflow schema apparently expects:

fickle badgerBOT
# severe minnow This is the active.md file https://cl1p.net/4562
"contact": "string"

but the model is probably interpreting that contact block as an object or list, like:

"contact": [
  { "name": "Nigel Muirhead", "role": "CEO", "linkedin": "..." }
]

That is why every leads.N.contact fails with “must be string”.

Smallest prompt/schema fix: tell the LLM to keep contact as one plain string, preserving the Markdown contact block:

fickle badgerBOT
# severe minnow This is the active.md file https://cl1p.net/4562
For each lead, contact MUST be a single string.
Copy the full Contact section into that string, using newline characters if needed.
Do not return contact as an object, array, null, or structured subfields.
If no contact exists, return "".

Expected shape:

{
  "company": "Agilisys",
  "contact": "Nigel Muirhead — CEO
LinkedIn: https://www.linkedin.com/in/nigel-muirhead-bbb25a47
Email pattern: nigel.muirhead@agilisys.co.uk (constructed)
Fiona Phillips — Chief People Officer
fickle badgerBOT
# severe minnow This is the active.md file https://cl1p.net/4562
LinkedIn: https://www.agilisys.co.uk/team/fiona-phillips/"
}

Better longer-term fix: change the schema so contact is an array of contact objects, because your source data is naturally structured. But if the rest of the workflow expects a simple draft-email string, coercing it to one string is the least invasive fix.

severe minnow
fickle badgerBOT
# severe minnow This is the script that read it https://cl1p.net/4564

The reader script confirms it: the schema is strict here:

contact: {
  type: "string"
}

but the prompt only says:

- Contact -> contact

For your active.md, Contact is a nested Markdown section, so the model is “helpfully” turning it into structured data. The schema then rejects it.

Smallest change: add an explicit rule right after "- Contact -> contact", in the prompt:

fickle badgerBOT
# severe minnow This is the script that read it https://cl1p.net/4564
"Contact -> contact as one plain string. Preserve names, roles, LinkedIn URLs, email patterns, and contact routes in that string.",
"Never return contact as an object, array, null, or nested fields.",
"If Contact is missing, set contact to 'Not specified'.",

I’d also strengthen the general missing-field rule from:

"If a field is missing from the Markdown, use 'Not specified' rather than guessing.",

to:

"All schema fields except score must be strings. If a field is missing from the Markdown, use 'Not specified' rather than guessing.",
fickle badgerBOT
# severe minnow This is the script that read it https://cl1p.net/4564
"Do not use objects, arrays, or null for any string field.",

If you want the more robust fix, change the schema instead:

contact: {
  type: "array",
  items: {
    type: "object",
    properties: {
      name: { type: "string" },
      role: { type: "string" },
      linkedin: { type: "string" },
      email: { type: "string" },
fickle badgerBOT
severe minnow
#

Can you give me the updated script then

#

Hello?

fickle badgerBOT
# severe minnow Hello?

I attached it just above as active-leads-reader-updated.js. If Discord didn’t show the attachment on your side, say so and I’ll paste the full script inline instead.

severe minnow
fickle badgerBOT