{"record":{"id":"4f8d4ed411b3dec0","repo":"larksuite/cli","slug":"no-file-i-o-provider-registered","errorCode":null,"errorMessage":"no file I/O provider registered","messagePattern":"no file I/O provider registered","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/runner.go","lineNumber":651,"sourceCode":"\t\t}\n\t}\n\tif p := fileio.GetProvider(); p != nil {\n\t\tc := context.Background()\n\t\tif ctx != nil {\n\t\t\tc = ctx.ctx\n\t\t}\n\t\treturn p.ResolveFileIO(c)\n\t}\n\treturn nil\n}\n\n// ResolveSavePath resolves a relative path to a validated absolute path via\n// FileIO.ResolvePath. It returns an error if no FileIO provider is registered\n// or if the path fails validation (e.g. traversal, symlink escape).\nfunc (ctx *RuntimeContext) ResolveSavePath(path string) (string, error) {\n\tfio := ctx.FileIO()\n\tif fio == nil {\n\t\treturn \"\", fmt.Errorf(\"no file I/O provider registered\")\n\t}\n\tresolved, err := fio.ResolvePath(path)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"resolve save path: %w\", err)\n\t}\n\tif resolved == \"\" {\n\t\treturn \"\", fmt.Errorf(\"resolve save path: empty result for %q\", path)\n\t}\n\treturn resolved, nil\n}\n\n// WrapOpenError matches a FileIO.Open/Stat error and wraps it with the\n// caller-provided message prefix.\nfunc WrapOpenError(err error, pathMsg, readMsg string) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\tif errors.Is(err, fileio.ErrPathValidation) {","sourceCodeStart":633,"sourceCodeEnd":669,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/runner.go#L633-L669","documentation":"ResolveSavePath resolves a user-supplied path via the context's FileIO provider. This error means no FileIO provider was registered on the RuntimeContext, so the runtime cannot perform any host/workspace file operations. It is a wiring error: the command runs in a context that did not install a file I/O provider.","triggerScenarios":"Calling ctx.ResolveSavePath (or FileIO()-dependent flows) on a RuntimeContext built without a FileIO provider — e.g. minimal/test contexts or runtimes meant for API-only commands.","commonSituations":"Using a save/output flag in a command whose runtime factory skipped FileIO registration; custom plugin hosts constructing RuntimeContext manually without a provider.","solutions":["Construct the RuntimeContext through the standard factory that registers FileIO (scoped to runtime.FileIO()/ValidatePath rules)","If the command may legitimately run without file I/O, check ctx.FileIO() == nil first and fail with a typed, actionable error instead of the raw message","In tests, register a temp-dir-backed FileIO provider"],"exampleFix":"// before\nout, err := ctx.ResolveSavePath(flag)\n// after\nif ctx.FileIO() == nil { return errs.NewValidationError(errs.SubtypeFailedPrecondition, \"saving is not supported in this runtime\") }\nout, err := ctx.ResolveSavePath(flag)","handlingStrategy":"validation","validationCode":"if ctx.FileIO() == nil {\n\treturn errs.NewValidationError(errs.SubtypeFailedPrecondition, \"file saving not supported in this runtime\")\n}\nout, err := ctx.ResolveSavePath(path)","typeGuard":"func canSave(ctx *common.RuntimeContext) bool { return ctx.FileIO() != nil }","tryCatchPattern":"out, err := ctx.ResolveSavePath(path)\nif err != nil && strings.Contains(err.Error(), \"no file I/O provider registered\") {\n\treturn errs.NewValidationError(errs.SubtypeFailedPrecondition, \"this command's runtime has no file I/O; cannot save\")\n}","preventionTips":["Build RuntimeContext via the factory that registers FileIO when the command supports saving","Check ctx.FileIO() before exposing save flags/paths in a command","In tests, register a temp-dir FileIO provider via cmdutil.TestFactory"],"tags":["go","file-io","runtime-context","initialization"],"backgroundTag":"file-provider-not-registered","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}