You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Chainlink外部适配器作业运行jsonparse环节报Could not resolve path错误

错误原因定位

1. 语法错误

你定义的parse任务中,path参数两侧额外添加的**属于无效标记,不符合Chainlink作业的TOML语法规则,会直接触发解析失败。
原错误代码:

parse        [type=jsonparse **path="data,MRData,RaceTable,Races[0],Results[0],number"** data="$(fetch)"]

修正后代码:

parse        [type=jsonparse path="data,MRData,RaceTable,Races[0],Results[0],number" data="$(fetch)"]

2. 数据类型不匹配错误

从接口返回结果可以看到,Races[0].Results[0].number字段为字符串类型,而后续encode_data任务要求传入uint256类型的数值,直接传入字符串会导致ABI编码失败。你需要在parse任务后新增一个数值转换任务:

parse        [type=jsonparse path="data,MRData,RaceTable,Races[0],Results[0],number" data="$(fetch)"]
# 新增类型转换任务,将字符串转为十进制数值
cast_to_int  [type=parseInt data="$(parse)" radix=10]

同步修改encode_data任务的参数引用:

encode_data  [type=ethabiencode abi="(uint256 value)" data="{ \"value\": $(cast_to_int) }"]

同时调整任务执行链路为:

decode_log -> decode_cbor -> fetch -> parse -> cast_to_int -> encode_data -> encode_tx -> submit_tx

3. 路径校验规则

如果你的外部适配器没有对目标接口的返回结果做额外封装,fetch任务直接返回接口原始响应,你需要删除path参数开头的data,前缀,修正为:

path="MRData,RaceTable,Races[0],Results[0],number"

你可以通过节点的任务运行日志查看fetch步骤的实际输出,确认路径层级是否正确。

可选优化

你当前配置的maxTaskDuration = "0s"代表任务无超时限制,建议修改为合理值如30s,避免网络异常时任务长期占用节点资源。


内容的提问来源于stack exchange,提问作者Daniel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.28 10:15:00