{"record":{"id":"5f217d961367fceb","repo":"siyuan-note/siyuan","slug":"path-must-not-be-empty","errorCode":null,"errorMessage":"--path must not be empty","messagePattern":"--path must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/asset.go","lineNumber":144,"sourceCode":"\t\t\tfmt.Fprintln(w, \"PATH\\tNAME\")\n\t\t\tfor _, item := range items {\n\t\t\t\tfmt.Fprintf(w, \"%s\\t%s\\n\", item.Item, item.Name)\n\t\t\t}\n\t\t\tw.Flush()\n\t\t\tfmt.Printf(\"\\n%d unused asset(s)\\n\", len(items))\n\t\t}\n\t\treturn nil\n\t},\n}\n\nvar assetCleanCmd = &cobra.Command{\n\tUse:   \"clean\",\n\tShort: \"Clean unused assets\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tsinglePath, _ := cmd.Flags().GetString(\"path\")\n\t\tif cmd.Flags().Changed(\"path\") {\n\t\t\tif singlePath == \"\" {\n\t\t\t\treturn fmt.Errorf(\"--path must not be empty\")\n\t\t\t}\n\t\t\tif dryRun {\n\t\t\t\trelativePath, _, err := model.ResolveUnusedDataAssetPath(singlePath)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfmt.Printf(\"[dry-run] Would remove unused asset: %s\\n\", relativePath)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tret, err := model.RemoveUnusedAsset(singlePath)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfmt.Println(ret)\n\t\t\treturn nil\n\t\t}\n\n\t\tif dryRun {","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/cli/cmd/asset.go#L126-L162","documentation":"The `siyuan asset clean` command accepts an optional --path flag to clean a single unused asset. If --path is explicitly provided but its value is an empty string, the command rejects it with this error rather than silently treating it as unset.","triggerScenarios":"Running `asset clean --path \"\"` (flag marked as Changed but with empty value), optionally with --dry-run.","commonSituations":"Scripts interpolating an empty variable into --path; shell quoting dropping the intended value.","solutions":["Either omit --path entirely (clean all unused assets) or supply a non-empty asset path.","Fix the script variable that resolves to an empty string.","Verify quoting so the shell passes the intended path as the flag value."],"exampleFix":"// before\nsiyuan asset clean --path \"$ASSET_PATH\"   # ASSET_PATH empty\n// after\nsiyuan asset clean   # or set ASSET_PATH to a real asset path","handlingStrategy":"validation","validationCode":"if [ -n \"${ASSET_PATH+x}\" ] && [ -z \"$ASSET_PATH\" ]; then echo \"--path given but empty\"; exit 1; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Either omit --path or provide a non-empty value; do not pass empty strings.","Guard interpolated variables in scripts for emptiness."],"tags":["cli","validation"],"backgroundTag":"invalid-cli-argument","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}