shadow1ng/fscan · error
Unsupported platform: {{.Arg1}}
Error message
Unsupported platform: {{.Arg1}} What it means
The crontask persistence plugin only supports Linux: it manipulates system cron files that do not exist in the same form on other operating systems. When Scan runs with runtime.GOOS != "linux", it returns a failed Result whose Error is built from the localized unsupported_platform template (rendered with the current OS). No system changes are made.
Source
Thrown at plugins/local/crontask.go:46
}
// NewCronTaskPlugin 创建计划任务持久化插件
func NewCronTaskPlugin() *CronTaskPlugin {
return &CronTaskPlugin{
BasePlugin: plugins.NewBasePlugin("crontask"),
}
}
// Scan 执行计划任务持久化 - 直接实现
func (p *CronTaskPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
config := session.Config
var output strings.Builder
if runtime.GOOS != "linux" {
return &plugins.Result{
Success: false,
Output: i18n.GetText("crontask_linux_only"),
Error: fmt.Errorf("%s", i18n.Tr("unsupported_platform", runtime.GOOS)),
}
}
// 从config获取配置
p.targetFile = config.PersistenceTargetFile
if p.targetFile == "" {
return &plugins.Result{
Success: false,
Output: i18n.GetText("persistence_file_required"),
Error: fmt.Errorf("%s", i18n.GetText("target_file_not_specified")),
}
}
// 检查目标文件是否存在
if _, err := os.Stat(p.targetFile); os.IsNotExist(err) {
return &plugins.Result{
Success: false,
Output: i18n.Tr("target_file_not_exist", p.targetFile),View on GitHub (pinned to 95cc12e753)
Solutions
- Run the crontask plugin only on Linux hosts (or in a Linux container).
- Gate the plugin in your task scheduler with a runtime.GOOS == "linux" check and skip it elsewhere.
- Use an OS-appropriate persistence mechanism on other platforms instead of this plugin.
- Treat the failed Result (Success=false) as an expected skip, not a crash, in orchestration code.
Example fix
// before
result := crontaskPlugin.Scan(ctx, cfg)
// after
if runtime.GOOS != "linux" {
return nil // plugin unsupported here
}
result := crontaskPlugin.Scan(ctx, cfg) Defensive patterns
Strategy: fallback
Validate before calling
if runtime.GOOS != "linux" {
return nil // skip crontask plugin
} Type guard
func crontaskSupported() bool { return runtime.GOOS == "linux" } Try / catch
res := plugin.Scan(ctx, cfg)
if !res.Success && strings.Contains(res.Error.Error(), "Unsupported platform") {
log.Println("crontask skipped: unsupported OS")
return nil
} Prevention
- Maintain a per-plugin OS support matrix and consult it in schedulers.
- Run plugin tests inside Linux containers for this plugin.
- Expect failed Results (not panics) for platform-skips and handle them.
When it happens
Trigger: Running the crontask plugin's Scan on darwin or windows (any non-Linux GOOS).
Common situations: Testing the persistence plugin locally on macOS during development; deploying an agent build to Windows servers; cross-platform test suites that exercise all plugins on the host OS.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- Target file not specified
- Unable to create any system cron task
- Unable to create persistence directory
- Unsupported platform: {{.Arg1}}
AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06).
Data as JSON: /api/errors/cc5a4bd2ed7ba536.
Report an issue: GitHub.