siyuan-note/siyuan · error
ObjectSetDataMethods: %v
Error message
ObjectSetDataMethods: %v
What it means
A recovered panic from ObjectSetDataMethods, the helper that attaches text()/json()/buffer()/arrayBuffer() to a JS object (used to give Response.body.raw or similar a way to materialize bytes). Any panic while calling object.Set for those methods is caught and wrapped.
Source
Thrown at kernel/plugin/sandbox.go:160
if Object == nil {
return fmt.Errorf("globalThis.Object is not an object")
}
seal, ok := goja.AssertFunction(Object.Get("seal"))
if !ok {
return fmt.Errorf("globalThis.Object.seal is not a function")
}
_, err := seal(Object, obj)
return err
}
// ObjectSetDataMethods attaches text(), json(), buffer() and arrayBuffer() methods to a JS object,
// each returning a Promise that resolves with the corresponding representation of data.
func ObjectSetDataMethods(p *KernelPlugin, rt *goja.Runtime, object *goja.Object, data []byte) (err error) {
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("ObjectSetDataMethods: %v", r)
}
}()
lo.Must0(object.Set("text", rt.ToValue(func(call goja.FunctionCall, rt *goja.Runtime) goja.Value {
promise, resolve, reject := rt.NewPromise()
runErr := p.worker.Run(func(rt *goja.Runtime) (result any, err error) {
result = string(data)
return
}, func(rt *goja.Runtime, result any, err error) {
if lo.IsNil(err) {
if resolveErr := resolve(result); resolveErr != nil {
logging.LogErrorf("[plugin:%s] data.text() resolve: %v", p.Name, resolveErr)
}
} else {
if rejectErr := reject(rt.NewGoError(err)); rejectErr != nil {
logging.LogErrorf("[plugin:%s] data.text() reject: %v", p.Name, rejectErr)
}View on GitHub (pinned to 251596fc0d)
Solutions
- Inspect the kernel log for the preceding error that left the object/runtime in a bad state.
- Update the kernel; this is a defensive guard against a should-not-happen condition.
- Simplify the response body (avoid large/binary payloads) to see if a specific code path triggers it.
- Report the panic value and plugin name if reproducible.
Defensive patterns
Strategy: try-catch
Try / catch
// internal; surface the prior error
try { /* use response data methods */ } catch (e) { if (/ObjectSetDataMethods/.test(String(e))) report(e); else throw e; } Prevention
- Treat as a symptom of an earlier nil/context error; inspect the log.
- Keep the kernel updated.
- Simplify response bodies to isolate the trigger and report.
When it happens
Trigger: A nil object is passed in, or the goja runtime is in a bad state when attaching the methods, causing object.Set to panic.
Common situations: Internal; surfaces while materializing a response/data object. Almost always a symptom of an earlier nil/context error, not a direct plugin mistake.
Related errors
- failed to enable extend modules: %v
- failed to inject global context: %v
- panic during siyuan.storage.list: %v
- failed to convert request value to object
- path %v: value is nil
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/7bde2e7a1d7a935d.
Report an issue: GitHub.