{"record":{"id":"2591801d734b58e9","repo":"fyne-io/fyne","slug":"unhandled-token-type-t-v","errorCode":null,"errorMessage":"unhandled token type: %T %+v","messagePattern":"unhandled token type: %T %\\+v","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/fyne/internal/mobile/binres/binres.go","lineNumber":588,"sourceCode":"\t\t}\n\t\tn := len(bx.stack)\n\t\tvar el *Element\n\t\tel, bx.stack = bx.stack[n-1], bx.stack[:n-1]\n\t\tif el.end != nil {\n\t\t\treturn fmt.Errorf(\"element end already exists\")\n\t\t}\n\t\tel.end = &ElementEnd{\n\t\t\tNodeHeader: NodeHeader{\n\t\t\t\tLineNumber: uint32(line),\n\t\t\t\tComment:    NoEntry,\n\t\t\t},\n\t\t\tNS:   el.NS,\n\t\t\tName: el.Name,\n\t\t}\n\tcase xml.Comment, xml.ProcInst:\n\t\t// discard\n\tdefault:\n\t\tpanic(fmt.Errorf(\"unhandled token type: %T %+v\", tkn, tkn))\n\t}\n\treturn nil\n}\n\n// addAttributes encodes the attributes of tkn and adds them to el.\n// Any attributes which were not already present in Pool are added to it.\nfunc addAttributes(tkn xml.StartElement, bx *XML, line int, pool *Pool, el *Element, tbl *Table) error {\n\tfor _, attr := range tkn.Attr {\n\t\tif (attr.Name.Space == \"xmlns\" && attr.Name.Local == \"tools\") || attr.Name.Space == toolsSchema {\n\t\t\tcontinue // TODO can tbl be queried for schemas to determine validity instead?\n\t\t}\n\n\t\tif attr.Name.Space == \"xmlns\" && attr.Name.Local == \"android\" {\n\t\t\tif bx.Namespace != nil {\n\t\t\t\treturn fmt.Errorf(\"multiple declarations of xmlns:android encountered\")\n\t\t\t}\n\t\t\tbx.Namespace = &Namespace{\n\t\t\t\tNodeHeader: NodeHeader{","sourceCodeStart":570,"sourceCodeEnd":606,"githubUrl":"https://github.com/fyne-io/fyne/blob/8860ee95c356385effa5a7be51adb11c6be9d2b6/cmd/fyne/internal/mobile/binres/binres.go#L570-L606","documentation":"Thrown by the Android binary-XML (AXML) compiler in fyne's vendored mobile tool. When 'fyne package -os android' compiles AndroidManifest.xml, binres walks encoding/xml tokens: it handles StartElement, EndElement and CharData, and discards Comment/ProcInst. Any other token type - in practice an xml.Directive such as '<!DOCTYPE ...>' - reaches the default branch and panics with the token's Go type and value.","triggerScenarios":"Running 'fyne package -os android' (or calling binres XML build) against a custom AndroidManifest.xml that contains an XML directive: a '<!DOCTYPE manifest ...>' declaration or '<!ELEMENT>'/'<!ENTITY>' lines produced by an XML editor or copied from an Android Studio project.","commonSituations":"Custom manifests pasted from tutorials or other projects that carry a DOCTYPE; manifests processed by XML tooling that emits directives; template files reused across projects.","solutions":["Remove the '<!DOCTYPE ...>' (or any other '<!...>') directive from AndroidManifest.xml - Android packaging does not need it","Re-serialize the manifest with xmllint or an editor so no directive tokens remain, then re-run fyne package","Upgrade fyne to a release that tolerates xml.Directive, or patch the default case in binres.go to discard xml.Directive like xml.Comment"],"exampleFix":"// before (AndroidManifest.xml)\n<!DOCTYPE manifest PUBLIC \"-//Android//DTD Android 3.0//EN\" \"http://schemas.android.com/apk/res/android\">\n<manifest ...>\n\n// after\n<manifest ...>","handlingStrategy":"validation","validationCode":"// Pre-flight: reject manifests containing XML directives before packaging.\ndec := xml.NewDecoder(manifestFile)\nfor {\n    tkn, err := dec.Token()\n    if err == io.EOF { break }\n    if err != nil { return err }\n    if _, ok := tkn.(xml.Directive); ok {\n        return fmt.Errorf(\"AndroidManifest.xml contains an XML directive; remove it before packaging\")\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep custom AndroidManifest.xml free of DOCTYPE and other directives; Android does not use them","Re-serialize pasted manifests through xmllint before committing","Run 'xmllint --noout AndroidManifest.xml' in CI before the fyne package step"],"tags":["go","android","xml","packaging","fyne-cli","manifest"],"backgroundTag":null,"analyzedSha":"8860ee95c356385effa5a7be51adb11c6be9d2b6","analyzedAt":"2026-08-15T22:01:51.624Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}