bettercap/bettercap · error

${input !== null && typeof input || input} is not observable

Error message

${input !== null && typeof input || input} is not observable

What it means

RxJS from() converts Observables, Promises, Arrays, Iterables, and strings into an Observable. If the input matches none of those shapes, from() throws a TypeError stating the input is not observable.

Source

Thrown at modules/ui/ui/vendor.js:97921

            return input;
        }
        return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](Object(_util_subscribeTo__WEBPACK_IMPORTED_MODULE_9__["subscribeTo"])(input));
    }
    if (input != null) {
        if (Object(_util_isInteropObservable__WEBPACK_IMPORTED_MODULE_3__["isInteropObservable"])(input)) {
            return Object(_fromObservable__WEBPACK_IMPORTED_MODULE_8__["fromObservable"])(input, scheduler);
        }
        else if (Object(_util_isPromise__WEBPACK_IMPORTED_MODULE_1__["isPromise"])(input)) {
            return Object(_fromPromise__WEBPACK_IMPORTED_MODULE_6__["fromPromise"])(input, scheduler);
        }
        else if (Object(_util_isArrayLike__WEBPACK_IMPORTED_MODULE_2__["isArrayLike"])(input)) {
            return Object(_fromArray__WEBPACK_IMPORTED_MODULE_5__["fromArray"])(input, scheduler);
        }
        else if (Object(_util_isIterable__WEBPACK_IMPORTED_MODULE_4__["isIterable"])(input) || typeof input === 'string') {
            return Object(_fromIterable__WEBPACK_IMPORTED_MODULE_7__["fromIterable"])(input, scheduler);
        }
    }
    throw new TypeError((input !== null && typeof input || input) + ' is not observable');
}
//# sourceMappingURL=from.js.map


/***/ }),

/***/ "./node_modules/rxjs/_esm5/internal/observable/fromArray.js":
/*!******************************************************************!*\
  !*** ./node_modules/rxjs/_esm5/internal/observable/fromArray.js ***!
  \******************************************************************/
/*! exports provided: fromArray */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromArray", function() { return fromArray; });
/* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
/* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");

View on GitHub (pinned to 8eca2820f3)

Solutions

  1. Check the input type before calling from(); wrap primitives/plain objects explicitly, e.g. from([value]) or of(value)
  2. If wrapping an object that only looks async, ensure it implements Symbol.asyncIterator or is a real Promise
  3. Use defer(() => value) when the value type varies at runtime
  4. Log typeof input and inspect it at the throw site

Example fix

// before
from(config).subscribe(...);
// after
from([config]).subscribe(...); // or of(config)
Defensive patterns

Strategy: type-guard

Validate before calling

function isFromConvertible(v) { return v != null && (typeof v[Symbol.observable] === 'function' || typeof v.then === 'function' || typeof v[Symbol.iterator] === 'function' || typeof v === 'string' || Array.isArray(v)); }

Type guard

function isObservableLike(v: any): v is Observable<unknown> { return !!v && typeof v[Symbol.observable] === 'function'; }

Try / catch

try { from(input).subscribe(next); } catch (e) { if (e instanceof TypeError && e.message.includes('is not observable')) { of(input).subscribe(next); } else throw e; }

Prevention

When it happens

Trigger: from(123), from({}), from(null) (null reports as 'null is not observable'), passing a non-iterable plain object, or a thenable lacking standard Promise semantics.

Common situations: Passing axios/config plain objects thinking they're streams; passing undefined due to an unfulfilled variable; migrating from RxJS 4 where from accepted more input types; forgetting that numbers and plain objects are not convertible.

Related errors


AI-assisted analysis of bettercap/bettercap@8eca2820f3 (2026-09-02). Data as JSON: /api/errors/65307eb582582684. Report an issue: GitHub.