{"record":{"id":"9e86c01ad38a6306","repo":"micro-editor/micro","slug":"terminal-emulator-is-not-supported-on-this-system","errorCode":null,"errorMessage":"Terminal emulator is not supported on this system","messagePattern":"Terminal emulator is not supported on this system","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/action/termpane.go","lineNumber":64,"sourceCode":"}\n\nfunc termMapMouse(k MouseEvent, action string) {\n\t// TODO: map mouse\n\ttermMapKey(k, action)\n}\n\ntype TermPane struct {\n\t*shell.Terminal\n\tdisplay.Window\n\n\tmouseReleased bool\n\tid            uint64\n\ttab           *Tab\n}\n\nfunc NewTermPane(x, y, w, h int, t *shell.Terminal, id uint64, tab *Tab) (*TermPane, error) {\n\tif !TermEmuSupported {\n\t\treturn nil, errors.New(\"Terminal emulator is not supported on this system\")\n\t}\n\n\tth := new(TermPane)\n\tth.Terminal = t\n\tth.id = id\n\tth.mouseReleased = true\n\tth.Window = display.NewTermWindow(x, y, w, h, t)\n\tth.tab = tab\n\treturn th, nil\n}\n\nfunc (t *TermPane) ID() uint64 {\n\treturn t.id\n}\n\nfunc (t *TermPane) SetID(i uint64) {\n\tt.id = i\n}","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/micro-editor/micro/blob/1c8b82b32e408a5faf340039ed92d5266bea3293/internal/action/termpane.go#L46-L82","documentation":"Returned by NewTermPane (internal/action/termpane.go:64) when the compiled-in constant TermEmuSupported is false — i.e. the same unsupported-platform condition as error [10], re-checked at the constructor as defense in depth. It prevents constructing a TermPane (which wraps a shell.Terminal plus display.TermWindow) in a build that has no pty support.","triggerScenarios":"Calling action.NewTermPane(...) directly (as command.go:1161 and terminal_supported.go:37 do) in a windows/plan9 build, or a fork/vendor that compiles termpane.go without terminal_supported.go so the constant stays false.","commonSituations":"Plugin code constructing terminal panes manually; maintainers porting micro to a new OS where the build tags were not updated and the unsupported stub still links.","solutions":["Gate the call: if !action.TermEmuSupported { skip / show message } before NewTermPane","Ensure your build compiles terminal_supported.go (unix) and never both stub and real implementation — check custom build tags in forks","For users: use WSL or an external terminal instead of the internal pane on Windows"],"exampleFix":"// before\ntp, err := NewTermPane(x, y, w, h, term, id, tab) // always errs on windows\n\n// after\nif !TermEmuSupported {\n    return nil, errors.New(\"Terminal emulator is not supported on this system\")\n}\ntp, err := NewTermPane(x, y, w, h, term, id, tab)","handlingStrategy":"type-guard","validationCode":"if !action.TermEmuSupported {\n    return nil, errors.New(\"terminal panes unavailable in this build\")\n}\ntp, err := action.NewTermPane(x, y, w, h, term, id, tab)","typeGuard":"// Guard before constructing the pane\nfunc newTermPaneSafe(x, y, w, h int, t *shell.Terminal, id uint64, tab *action.Tab) (*action.TermPane, error) {\n    if !action.TermEmuSupported {\n        return nil, errors.New(\"Terminal emulator is not supported on this system\")\n    }\n    return action.NewTermPane(x, y, w, h, t, id, tab)\n}","tryCatchPattern":"tp, err := NewTermPane(v.X, v.Y, v.Width, v.Height, t, id, MainTab())\nif err != nil {\n    if strings.Contains(err.Error(), \"not supported on this system\") {\n        // build lacks pty support: present the external-shell fallback once\n        InfoBar.Error(err)\n        return nil\n    }\n    return err\n}","preventionTips":["Never construct TermPane without first checking the TermEmuSupported constant","In forks, make sure build tags select exactly one of terminal_supported.go / terminal_unsupported.go","Plugin UIs should hide the '> term' entry when the guard reports false"],"tags":["terminal","platform","constructor","windows","unsupported"],"backgroundTag":null,"analyzedSha":"1c8b82b32e408a5faf340039ed92d5266bea3293","analyzedAt":"2026-08-15T20:01:45.134Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}