Skip to content

GraphQL IDE validation errors: "Unknown argument" on @arguments and @with directives #1576

@ahmed-abdelhamid-11

Description

@ahmed-abdelhamid-11

Description

When using fragment arguments with @arguments and @with directives, GraphQL IDE extensions (VS Code GraphQL extension, etc.) report false positive errors like:

  • Unknown argument "myArg" on directive "@arguments"
  • Unknown argument "myArg" on directive "@with"

The code works correctly - houdini generate succeeds and the app runs fine. The issue is purely with IDE validation.

Reproduction

Fragment definition:

fragment MyFragment on MyType @arguments(includeField: { type: "Boolean", default: false }) {
	id
	optionalField @include(if: $includeField)
}

Query using the fragment:

query MyQuery($includeField: Boolean = false) {
	myData {
		...MyFragment @with(includeField: $includeField)
	}
}

Root Cause

The generated schema at .houdini/graphql/schema.graphql defines the directives without argument signatures:

directive @arguments on FRAGMENT_DEFINITION
directive @with on FRAGMENT_SPREAD

This is correct behavior since Houdini allows arbitrary arguments dynamically. However, the GraphQL Language Server doesn't understand this pattern and validates strictly against the schema.

Attempted Workarounds (None Working)

We tried the following approaches, but none resolved the IDE validation errors:

  1. Disabling validation rules in .graphqlrc.yaml:

    extensions:
      languageService:
        diagnostics:
          disable: [KnownArgumentNamesOnDirectives]
  2. Adding .ts files to documents config

  3. Restarting IDE / TypeScript server

None of these suppress the "Unknown argument" errors in the IDE.

Feature Request

Would it be possible to generate the directive definitions with the actual arguments based on what's used in the codebase? For example, after running houdini generate, the schema could include:

directive @arguments(includeField: ArgumentDefinition) on # ... other discovered arguments
FRAGMENT_DEFINITION

Or alternatively, document the recommended .graphqlrc.yaml configuration to suppress these validation errors?

Environment

  • Houdini version: 2.0.0-next.11
  • Houdini Svelte version: 3.0.0-next.13
  • IDE: VS Code/Cursor with GraphQL extension

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions