{"record":{"id":"327c10b9590bcc2c","repo":"Tencent/WeKnora","slug":"invalid-book-id-q-w","errorCode":null,"errorMessage":"invalid book id %q: %w","messagePattern":"invalid book id %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/datasource/connector/yuque/connector.go","lineNumber":169,"sourceCode":"\tctx context.Context,\n\tconfig *types.DataSourceConfig,\n\tresourceIDs []string,\n\tprev *yuqueCursor,\n\tincremental bool,\n) ([]types.FetchedItem, *yuqueCursor, error) {\n\tcfg, err := parseYuqueConfig(config)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tcli := newClient(cfg)\n\n\tnewCursor := &yuqueCursor{LastSyncTime: time.Now(), BookDocTimes: make(map[string]map[string]string)}\n\tvar out []types.FetchedItem\n\n\tfor _, bookIDStr := range resourceIDs {\n\t\tbookID, err := strconv.ParseInt(bookIDStr, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"invalid book id %q: %w\", bookIDStr, err)\n\t\t}\n\n\t\tdocs, err := cli.ListBookDocs(ctx, bookID)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"list docs for book %d: %w\", bookID, err)\n\t\t}\n\n\t\tcurrentDocs := make(map[string]bool)\n\t\tnewCursor.BookDocTimes[bookIDStr] = make(map[string]string)\n\n\t\tvar skippedType, skippedDraft, kept int\n\t\tvar sampleSkipType, sampleSkipDraft string\n\t\tfor _, d := range docs {\n\t\t\t// Empty type/status is treated as acceptable — forward-compat with\n\t\t\t// API variations that omit the field.\n\t\t\tif d.Type != \"\" && d.Type != \"Doc\" {\n\t\t\t\tskippedType++\n\t\t\t\tif sampleSkipType == \"\" {","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/datasource/connector/yuque/connector.go#L151-L187","documentation":"In walk, each configured resource ID must be a Yuque book (repo) numeric ID. This error is thrown when strconv.ParseInt fails on a configured resource ID string, meaning the datasource config contains a book ID that is not a plain integer. The %q preserves the offending value and %w preserves strconv's parse error (e.g. invalid syntax or value out of range).","triggerScenarios":"config.ResourceIDs contains a non-numeric string — e.g. a repo slug like \"my-wiki\", a URL copied from the browser containing a namespace, whitespace, or a value exceeding int64 range.","commonSituations":"User pasted a repo namespace (login/slug) instead of the numeric ID; copied the ID with trailing spaces or quotes; used a slug-based config from an older connector version that accepted slugs.","solutions":["Open the repo in Yuque and copy the numeric book ID from the URL or API (GET /api/v2/users/{login}/repos returns numeric id fields)","Remove whitespace/quotes around the ID in the datasource config","Replace any slug/namespace values in ResourceIDs with the corresponding numeric IDs","Log config.ResourceIDs at startup to catch malformed entries before walking"],"exampleFix":"// before\nresourceIDs: [\"my-team/my-wiki\", \" 12345 \"]\n// after\nresourceIDs: [\"12345\"] // numeric book IDs only, no slugs or spaces","handlingStrategy":"validation","validationCode":"func validBookIDs(ids []string) error {\n    for _, id := range ids {\n        if _, err := strconv.ParseInt(strings.TrimSpace(id), 10, 64); err != nil {\n            return fmt.Errorf(\"book id %q is not a numeric yuque book id\", id)\n        }\n    }\n    return nil\n}","typeGuard":"func isNumericBookID(s string) bool {\n    _, err := strconv.ParseInt(s, 10, 64)\n    return err == nil\n}","tryCatchPattern":"items, _, err := ds.Fetch(ctx, cfg, cursor)\nif err != nil {\n    var pe *strconv.NumError\n    if errors.As(err, &pe) {\n        return fmt.Errorf(\"fix ResourceIDs: contains non-numeric value: %v\", err)\n    }\n    return err\n}","preventionTips":["Copy numeric IDs from the Yuque repo URL or API, never slugs/namespaces","Trim whitespace and strip quotes when editing config","Validate ResourceIDs at config-save time with a numeric check","Add a startup sanity check that all resource IDs parse as int64"],"tags":["yuque","config","validation","strconv","connector"],"backgroundTag":"invalid-resource-id-config","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}