siyuan-note/siyuan · error

--id is required

Error message

--id is required

What it means

Thrown by the `inbox get` subcommand when `--id` is empty. The flag names a specific cloud inbox shorthand (web-clip) to fetch; it is forwarded to `model.GetCloudShorthand`, which calls the SiYuan cloud service. Without an ID the lookup has no target.

Source

Thrown at kernel/cli/cmd/inbox.go:91

				url, _ := sh["shorthandURL"].(string)
				hCreated, _ := sh["hCreated"].(string)
				fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", id, title, url, hCreated)
			}
			w.Flush()
			fmt.Printf("\n%d item(s) on page %d\n", len(shorthands), page)
		}
		return nil
	},
}

// inboxGetCmd 取单条收集箱详情,返回完整 markdown 正文(shorthandMd)。
var inboxGetCmd = &cobra.Command{
	Use:   "get --id <id>",
	Short: "Get a cloud inbox shorthand with full markdown",
	RunE: func(cmd *cobra.Command, args []string) error {
		id, _ := cmd.Flags().GetString("id")
		if id == "" {
			return fmt.Errorf("--id is required")
		}

		sh, err := model.GetCloudShorthand(id)
		if err != nil {
			return err
		}

		switch outputFormat {
		case "json":
			data, _ := json.MarshalIndent(sh, "", "  ")
			fmt.Println(string(data))
		default:
			title, _ := sh["shorthandTitle"].(string)
			url, _ := sh["shorthandURL"].(string)
			hCreated, _ := sh["hCreated"].(string)
			md, _ := sh["shorthandMd"].(string)
			fmt.Println("ID:     ", id)
			fmt.Println("TITLE:  ", title)

View on GitHub (pinned to 251596fc0d)

Solutions

  1. List inbox entries first: `siyuan inbox list`
  2. Fetch by ID: `siyuan inbox get --id <shorthandID>`

Example fix

// before
siyuan inbox get
// after
siyuan inbox get --id 16890001
Defensive patterns

Strategy: validation

Validate before calling

if id == "" {
    out, _ := cmd.Output("siyuan", "inbox", "list")
    log.Fatalf("shorthand ID required. Inbox:\n%s", out)
}

Prevention

When it happens

Trigger: Running `siyuan inbox get` with no `--id`. The RunE validates the flag before calling `model.GetCloudShorthand(id)`. Note this requires cloud connectivity and authentication.

Common situations: Forgetting the shorthand ID; not having run `inbox list` to discover IDs; cloud sync not configured so no shorthands exist.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/23a90176826b3e42. Report an issue: GitHub.