{"record":{"id":"62fb74710ef60004","repo":"fyne-io/fyne","slug":"encountered-empty-values-slice","errorCode":null,"errorMessage":"encountered empty values slice","messagePattern":"encountered empty values slice","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/fyne/internal/mobile/binres/binres.go","lineNumber":662,"sourceCode":"\t}\n\treturn nil\n}\n\n// addAttributeNamespace encodes attr based on its namespace\n// The encoded value is stored in nattr.\n// If the value was not already present in pool, it is added.\nfunc addAttributeNamespace(attr xml.Attr, nattr *Attribute, tbl *Table, pool *Pool) error {\n\t// get type spec and value data type\n\tref, err := tbl.RefByName(\"attr/\" + attr.Name.Local)\n\tif err != nil {\n\t\treturn err\n\t}\n\tnt, err := ref.Resolve(tbl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(nt.values) == 0 {\n\t\tpanic(\"encountered empty values slice\")\n\t}\n\n\tif len(nt.values) == 1 {\n\t\tval := nt.values[0]\n\t\tif val.data.Type != DataIntDec {\n\t\t\tpanic(\"TODO only know how to handle DataIntDec type here\")\n\t\t}\n\n\t\tt := DataType(val.data.Value)\n\t\tswitch t {\n\t\tcase DataString, DataAttribute, DataType(0x3e):\n\t\t\t// TODO identify 0x3e, in bootstrap.xml this is the native lib name\n\t\t\tnattr.RawValue = pool.ref(attr.Value)\n\t\t\tnattr.TypedValue.Type = DataString\n\t\t\tnattr.TypedValue.Value = uint32(nattr.RawValue)\n\t\tcase DataIntBool, DataType(0x08):\n\t\t\tnattr.TypedValue.Type = DataIntBool\n\t\t\tswitch attr.Value {","sourceCodeStart":644,"sourceCodeEnd":680,"githubUrl":"https://github.com/fyne-io/fyne/blob/8860ee95c356385effa5a7be51adb11c6be9d2b6/cmd/fyne/internal/mobile/binres/binres.go#L644-L680","documentation":"While encoding an android:-namespace attribute, addAttributeNamespace looks the name up in the vendored Android framework table ('attr/' + Local) and resolves its type spec. If that spec exists but its values slice is empty, the encoder has no data type to derive from and panics. It means the attribute name matched a table entry that ships in fyne's bundled bootstrap data without value definitions.","triggerScenarios":"A custom AndroidManifest.xml containing an attribute whose framework type spec resolves with zero values - typically newer-SDK attributes that fyne's vendored binres tables define (or partially define) without any value entries.","commonSituations":"Adding modern manifest attributes (android:requestLegacyExternalStorage, android:appComponentFactory, network security config keys) to a manifest built by an older fyne; SDK templates copied from newer Android Studio; vendored tables lagging the Android SDK.","solutions":["Bisect the custom manifest attributes and remove the offending one (re-run packaging after each removal)","Update fyne so the vendored framework tables match your target SDK","If the attribute is required, file an upstream issue with the exact attribute name or patch the vendored table data"],"exampleFix":"// before (AndroidManifest.xml, built with an older fyne)\n<application android:requestLegacyExternalStorage=\"true\" ...>\n\n// after - drop the attribute the old tables cannot resolve\n<application ...>","handlingStrategy":"validation","validationCode":"// Pre-flight: whitelist manifest attributes against what your fyne version is known to encode.\nallowed := map[string]bool{\n    \"allowBackup\": true, \"icon\": true, \"label\": true, \"theme\": true,\n    \"name\": true, \"minSdkVersion\": true, \"targetSdkVersion\": true, \"versionCode\": true, \"versionName\": true,\n}\nfor _, a := range manifestAttributes {\n    if !allowed[a] {\n        log.Printf(\"attribute %q is not vetted for this fyne release; verify before packaging\", a)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add new android: attributes one at a time so the culprit is obvious from the last diff","Match your fyne version to the Android SDK level your manifest targets","Keep custom manifests minimal; let fyne generate the default and override only known keys"],"tags":["android","xml","manifest","resources","packaging","go"],"backgroundTag":null,"analyzedSha":"8860ee95c356385effa5a7be51adb11c6be9d2b6","analyzedAt":"2026-08-15T22:01:51.624Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}