{"record":{"id":"26cc7b4d78aee5d7","repo":"larksuite/cli","slug":"expected-s-got-s-26cc7b","errorCode":null,"errorMessage":"expected <%s>, got <%s>","messagePattern":"expected <(.+?)>, got <(.+?)>","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/doc/local_doc_resources.go","lineNumber":2341,"sourceCode":"\treturn out.String()\n}\n\nfunc parseLocalDocResourceTag(raw, expected string) (localDocResourceTag, error) {\n\tif expected == \"img\" {\n\t\traw = escapeBareXMLAmpersandsInTagAttr(raw, \"href\")\n\t}\n\tdecoder := xml.NewDecoder(strings.NewReader(raw))\n\tfor {\n\t\ttoken, err := decoder.Token()\n\t\tif err != nil {\n\t\t\treturn localDocResourceTag{}, err\n\t\t}\n\t\tstart, ok := token.(xml.StartElement)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tif start.Name.Local != expected {\n\t\t\treturn localDocResourceTag{}, fmt.Errorf(\"expected <%s>, got <%s>\", expected, start.Name.Local) //nolint:forbidigo // caller wraps with typed validation error.\n\t\t}\n\t\tattrs := make([]html5BlockAttr, 0, len(start.Attr))\n\t\tseenAttrs := make(map[string]struct{}, len(start.Attr))\n\t\tfor _, attr := range start.Attr {\n\t\t\tattrName := strings.ToLower(strings.TrimSpace(attr.Name.Local))\n\t\t\tif _, exists := seenAttrs[attrName]; exists {\n\t\t\t\treturn localDocResourceTag{}, fmt.Errorf(\"duplicate attribute %q\", attrName) //nolint:forbidigo // caller wraps with typed validation error.\n\t\t\t}\n\t\t\tseenAttrs[attrName] = struct{}{}\n\t\t\tattrs = append(attrs, html5BlockAttr{Name: attr.Name.Local, Value: attr.Value})\n\t\t}\n\t\treturn localDocResourceTag{Name: expected, Attrs: attrs, SelfClosing: strings.HasSuffix(strings.TrimSpace(raw), \"/>\")}, nil\n\t}\n}\n\nfunc escapeBareXMLAmpersandsInTagAttr(raw, targetAttr string) string {\n\tfor i := 1; i < len(raw); {\n\t\tfor i < len(raw) && isXMLSpace(raw[i]) {","sourceCodeStart":2323,"sourceCodeEnd":2359,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/doc/local_doc_resources.go#L2323-L2359","documentation":"parseLocalDocResourceTag: the decoded first XML start element's name is not the tag the caller expected (img/a/etc.) - the block was routed to the wrong parser or the markup deviates; caller wraps it into a typed validation error.","triggerScenarios":"Thrown at shortcuts/doc/local_doc_resources.go:2341 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the local-doc block is the expected tag type, or extend block routing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}