siyuan-note/siyuan · error

--name is required

Error message

--name is required

What it means

Thrown by the `notebook create` subcommand when the `--name` flag is empty. The name becomes the notebook's display title. The check runs before the dry-run guard, so it fires in all modes.

Source

Thrown at kernel/cli/cmd/notebook.go:69

		}
		switch outputFormat {
		case "json":
			data, _ := json.MarshalIndent(boxes, "", "  ")
			fmt.Println(string(data))
		default:
			printNotebookTable(boxes)
		}
		return nil
	},
}

var notebookCreateCmd = &cobra.Command{
	Use:   "create --name <name>",
	Short: "Create a notebook",
	RunE: func(cmd *cobra.Command, args []string) error {
		name, _ := cmd.Flags().GetString("name")
		if name == "" {
			return fmt.Errorf("--name is required")
		}

		if dryRun {
			fmt.Printf("[dry-run] Would create notebook \"%s\"\n", name)
			return nil
		}

		id, err := model.CreateBox(name)
		if err != nil {
			return err
		}
		if _, err = model.Mount(id); err != nil {
			return fmt.Errorf("notebook [%s] was created but could not be opened: %w", id, err)
		}
		model.AppendPushReloadFiletreeEntry()
		fmt.Println(id)
		return nil
	},

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Supply a name: `siyuan notebook create --name "My Notebook"`
  2. Use a non-empty quoted string if the name contains spaces

Example fix

// before
siyuan notebook create
// after
siyuan notebook create --name "Research"
Defensive patterns

Strategy: validation

Validate before calling

name := strings.TrimSpace(rawName)
if name == "" {
    return errors.New("notebook name is required")
}

Prevention

When it happens

Trigger: Running `siyuan notebook create` with no `--name`, or `--name ""`. The RunE reads the flag and returns immediately when it is empty.

Common situations: Typing the command without a name; passing an empty variable; assuming a default name is supplied.

Related errors


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