Skip to content

Cannot read property 'ancestors' of null #1948

@luveti

Description

@luveti

Context

  • node version: v10.11.0
  • joi version: 16.0.0-rc2
  • environment: node
  • used with: fastify

Stacktrace

node_modules/@hapi/joi/lib/ref.js:73
        Hoek.assert(this.type !== 'value' || !ancestor || ancestor <= state.ancestors.length, 'Invalid reference exceeds the schema root:', this.display);
                                                                            ^

TypeError: Cannot read property 'ancestors' of null
    at module.exports.internals.Ref.resolve (node_modules/@hapi/joi/lib/ref.js:73:77)
    at module.exports.internals.Template.render (node_modules/@hapi/joi/lib/template.js:102:63)
    at exports.Report.toString (node_modules/@hapi/joi/lib/errors.js:83:33)
    at Object.exports.details (node_modules/@hapi/joi/lib/errors.js:173:30)
    at Object.exports.process (node_modules/@hapi/joi/lib/errors.js:136:52)
    at Object.exports.process (node_modules/@hapi/joi/lib/validator.js:21:27)
    at internals.Object.validate (node_modules/@hapi/joi/lib/types/any.js:544:26)
    at dist/routes/helpers.js:14:54
    at validateParam (node_modules/fastify/lib/validation.js:70:34)
    at validate (node_modules/fastify/lib/validation.js:82:14)

Visualization

image

Let me know if you'd like a reproduction, but I think the issue is pretty easy to see! But I may be missing something.

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions