openclaw - ✅(Solved) Fix [Bug]: skills.entries.<skill>.apiKey file SecretRef passes secrets audit / secrets reload but remains unresolved during embedded run startup [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#49427Fetched 2026-04-08 00:55:22
View on GitHub
Comments
1
Participants
2
Timeline
10
Reactions
0
Author
Timeline (top)
cross-referenced ×4referenced ×3labeled ×2commented ×1

I’m seeing inconsistent behavior with file-backed SecretRefs.

A file SecretRef works correctly for:

tools.web.search.gemini.apiKey …but a file SecretRef does not work for:

skills.entries.nano-banana-pro.apiKey Specifically:

openclaw secrets audit --check reports unresolved=0 openclaw secrets reload succeeds config reload logs say the relevant path was applied but a fresh embedded session still fails with:

skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:filemain:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it.

This suggests file-backed SecretRefs themselves are not generally broken, but the skills.entries.<skill>.apiKey path is not being materialized into a resolved string before embedded skill env injection.

Error Message

02:23:42 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=main durationMs=4 error="Error: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it." 02:23:42 error [diagnostic] lane task error: lane=main durationMs=4 error="Error: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it." 02:23:42 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=session:agent:main:whatsapp:direct: durationMs=6 error="Error: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it." 02:23:42 error [diagnostic] lane task error: lane=session:agent:main:whatsapp:direct:durationMs=6 error="Error: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it." 02:23:42 error Embedded agent failed before reply: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it.

Root Cause

I’m seeing inconsistent behavior with file-backed SecretRefs.

A file SecretRef works correctly for:

tools.web.search.gemini.apiKey …but a file SecretRef does not work for:

skills.entries.nano-banana-pro.apiKey Specifically:

openclaw secrets audit --check reports unresolved=0 openclaw secrets reload succeeds config reload logs say the relevant path was applied but a fresh embedded session still fails with:

skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:filemain:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it.

This suggests file-backed SecretRefs themselves are not generally broken, but the skills.entries.<skill>.apiKey path is not being materialized into a resolved string before embedded skill env injection.

Fix Action

Fixed

PR fix notes

PR #49447: fix: resolve SecretRef for skills.entries.<skill>.apiKey in embedded runs

Description (problem / solution / changelog)

问题背景

Issue #49427: skills.entries.<skill>.apiKey 的文件类型 SecretRef 在 embedded skill 启动时未能解析,报错 "unresolved SecretRef"。

根因分析

src/agents/skills/env-overrides.ts 中,代码使用同步函数 normalizeResolvedSecretInputString 来处理 apiKey,但该函数只会检查值是否已经是字符串,不会解析 SecretRef(文件引用)。

tools.web.search.gemini.apiKey 使用异步的 resolveSecretInputString 能正常工作。

修复方案

env-overrides.ts 中的 apiKey 解析改为使用异步的 resolveSecretInputString

  1. 导入 resolveSecretInputString
  2. applySkillConfigEnvOverrides 改为 async 函数
  3. 使用 await 调用 resolveSecretInputString 来解析 apiKey

测试方式

  1. 配置 file secret provider
  2. 在 skills.entries.<skill>.apiKey 中使用文件 SecretRef
  3. 启动 embedded session,验证 apiKey 被正确解析

风险与影响范围

  • 仅影响 skills.entries.<skill>.apiKey 的解析
  • 不影响 tools.web.search.gemini.apiKey 等其他配置
  • 需要调用者添加 await(已同步更新)

Changed files

  • src/agents/pi-embedded-runner/compact.ts (modified, +2/-2)
  • src/agents/pi-embedded-runner/run/attempt.ts (modified, +2/-2)
  • src/agents/skills/env-overrides.ts (modified, +15/-9)

Code Example

02:23:42 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=main durationMs=4 error="Error: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it."
02:23:42 error [diagnostic] lane task error: lane=main durationMs=4 error="Error: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it."
02:23:42 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=session:agent:main:whatsapp:direct: durationMs=6 error="Error: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it."
02:23:42 error [diagnostic] lane task error: lane=session:agent:main:whatsapp:direct:durationMs=6 error="Error: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it."
02:23:42 error Embedded agent failed before reply: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it.
RAW_BUFFERClick to expand / collapse

Bug type

Crash (process/app exits or hangs)

Summary

I’m seeing inconsistent behavior with file-backed SecretRefs.

A file SecretRef works correctly for:

tools.web.search.gemini.apiKey …but a file SecretRef does not work for:

skills.entries.nano-banana-pro.apiKey Specifically:

openclaw secrets audit --check reports unresolved=0 openclaw secrets reload succeeds config reload logs say the relevant path was applied but a fresh embedded session still fails with:

skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:filemain:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it.

This suggests file-backed SecretRefs themselves are not generally broken, but the skills.entries.<skill>.apiKey path is not being materialized into a resolved string before embedded skill env injection.

Steps to reproduce

Configure a file secret provider: { "secrets": { "providers": { "filemain": { "source": "file", "path": "/home/user/.openclaw/secrets.json", "mode": "json" } }, "defaults": { "file": "filemain" } } }

Put the Gemini API key in ~/.openclaw/secrets.json under both of these paths: /tools/web/search/gemini/apiKey /skills/entries/nano-banana-pro/apiKey Configure:

tools.web.search.gemini.apiKey as a file SecretRef skills.entries.nano-banana-pro.apiKey as a file SecretRef

Run:

openclaw secrets audit --check openclaw secrets reload

Confirm the web search tool works with Gemini.

Start a fresh embedded session / send a message that triggers embedded agent startup with the Nano Banana skill config loaded.

Expected behavior

both SecretRefs should resolve from the file provider tools.web.search.gemini.apiKey should work skills.entries.nano-banana-pro.apiKey should also resolve correctly

embedded sessions should start normally

the skill should receive its resolved API key (for example via GEMINI_API_KEY injection or equivalent runtime handling)

Actual behavior

tools.web.search.gemini.apiKey appears to resolve and work correctly skills.entries.nano-banana-pro.apiKey fails during embedded startup with:

skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:filemain:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it.

this happens even though: openclaw secrets audit --check reports unresolved=0 openclaw secrets reload succeeds logs show the config change was applied

OpenClaw version

v2026.3.13

Operating system

Ubuntu 24.04

Install method

npm global

Model

openai-codex/gpt-5.4

Provider / routing chain

openclaw

Config file / key location

~/.openclaw/openclaw.json

Additional provider/model setup details

No response

Logs, screenshots, and evidence

02:23:42 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=main durationMs=4 error="Error: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it."
02:23:42 error [diagnostic] lane task error: lane=main durationMs=4 error="Error: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it."
02:23:42 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=session:agent:main:whatsapp:direct: durationMs=6 error="Error: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it."
02:23:42 error [diagnostic] lane task error: lane=session:agent:main:whatsapp:direct:durationMs=6 error="Error: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it."
02:23:42 error Embedded agent failed before reply: skills.entries.nano-banana-pro.apiKey: unresolved SecretRef "file:default:/skills/entries/nano-banana-pro/apiKey". Resolve this command against an active gateway runtime snapshot before reading it.

Impact and severity

No response

Additional information

No response

extent analysis

Fix Plan

To resolve the issue with the skills.entries.nano-banana-pro.apiKey SecretRef, we need to ensure that the secret is properly resolved before the embedded session starts.

Here are the steps to fix the issue:

  • Verify that the skills.entries.nano-banana-pro.apiKey path exists in the secrets.json file and that the file is correctly configured as a secret provider.
  • Check the OpenClaw configuration to ensure that the skills.entries.nano-banana-pro.apiKey SecretRef is correctly defined and referenced.
  • Update the OpenClaw configuration to use the correct secret provider for the skills.entries.nano-banana-pro.apiKey SecretRef.

Example configuration update:

{
  "secrets": {
    "providers": {
      "filemain": {
        "source": "file",
        "path": "/home/user/.openclaw/secrets.json",
        "mode": "json"
      }
    },
    "defaults": {
      "file": "filemain"
    }
  }
}

In the secrets.json file, ensure that the skills.entries.nano-banana-pro.apiKey path is correctly defined:

{
  "/tools/web/search/gemini/apiKey": "gemini_api_key",
  "/skills/entries/nano-banana-pro/apiKey": "nano_banana_pro_api_key"
}

Verification

To verify that the fix worked, run the following commands:

  • openclaw secrets audit --check to ensure that there are no unresolved secrets.
  • openclaw secrets reload to reload the secrets configuration.
  • Start a fresh embedded session and verify that the skills.entries.nano-banana-pro.apiKey SecretRef is correctly resolved.

Extra Tips

  • Ensure that the secrets.json file is correctly formatted and that the paths are correctly defined.
  • Verify that the OpenClaw configuration is correctly updated and that the skills.entries.nano-banana-pro.apiKey SecretRef is correctly referenced.
  • If issues persist, check the OpenClaw logs for any error messages related to secret resolution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

both SecretRefs should resolve from the file provider tools.web.search.gemini.apiKey should work skills.entries.nano-banana-pro.apiKey should also resolve correctly

embedded sessions should start normally

the skill should receive its resolved API key (for example via GEMINI_API_KEY injection or equivalent runtime handling)

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: skills.entries.<skill>.apiKey file SecretRef passes secrets audit / secrets reload but remains unresolved during embedded run startup [1 pull requests, 1 comments, 2 participants]