{"record":{"id":"953cd79a3e35813a","repo":"angular/components","slug":"connectedposition-invalid-property-value-953cd7","errorCode":null,"errorMessage":"ConnectedPosition: Invalid ${property} \"${value}\". Expected \"start\", \"end\" or \"center\".","messagePattern":"ConnectedPosition: Invalid (.+?) \"(.+?)\"\\. Expected \"start\", \"end\" or \"center\"\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cdk/overlay/position/connected-position.ts","lineNumber":123,"sourceCode":" */\nexport function validateVerticalPosition(property: string, value: VerticalConnectionPos) {\n  if (value !== 'top' && value !== 'bottom' && value !== 'center') {\n    throw Error(\n      `ConnectedPosition: Invalid ${property} \"${value}\". ` +\n        `Expected \"top\", \"bottom\" or \"center\".`,\n    );\n  }\n}\n\n/**\n * Validates whether a horizontal position property matches the expected values.\n * @param property Name of the property being validated.\n * @param value Value of the property being validated.\n * @docs-private\n */\nexport function validateHorizontalPosition(property: string, value: HorizontalConnectionPos) {\n  if (value !== 'start' && value !== 'end' && value !== 'center') {\n    throw Error(\n      `ConnectedPosition: Invalid ${property} \"${value}\". ` +\n        `Expected \"start\", \"end\" or \"center\".`,\n    );\n  }\n}\n","sourceCodeStart":105,"sourceCodeEnd":129,"githubUrl":"https://github.com/angular/components/blob/0411926e7d8ae06b32236ec1048a888cfad5abf2/src/cdk/overlay/position/connected-position.ts#L105-L129","documentation":"validateHorizontalPosition checks that every horizontal connection value in a ConnectedPosition (originX / overlayX) is one of 'start', 'end', or 'center'. Anything else throws at strategy construction (dev mode only). It mirrors validateVerticalPosition for the horizontal axis.","triggerScenarios":"Passing a positions object to flexibleConnectedTo with originX or overlayX set to an invalid value like 'left', 'right', 'Left', or an undefined runtime variable.","commonSituations":"Using CSS vocabulary ('left'/'right') instead of the CDK's logical values ('start'/'end'); config-driven position maps containing legacy values; mixing RTL assumptions into the literal values.","solutions":["Set originX/overlayX to exactly 'start', 'end', or 'center'.","Annotate the array as ConnectedPosition[] so invalid literals fail typechecking.","Normalize RTL logic via the strategy's built-in handling rather than swapping in 'left'/'right' values.","Validate config-provided values against an allowlist before constructing the strategy."],"exampleFix":"// before\nconst pos = { originX: 'left', overlayX: 'right', originY: 'bottom', overlayY: 'top' };\n// after\nconst pos: ConnectedPosition = { originX: 'start', overlayX: 'end', originY: 'bottom', overlayY: 'top' };","handlingStrategy":"validation","validationCode":"const HORIZONTAL = new Set(['start', 'end', 'center']);\nif (!HORIZONTAL.has(position.originX) || !HORIZONTAL.has(position.overlayX)) {\n  throw new Error(`originX/overlayX must be start|end|center, got ${position.originX}/${position.overlayX}`);\n}","typeGuard":"type HorizontalConnectionPos = 'start' | 'end' | 'center';\nfunction isValidHorizontal(v: unknown): v is HorizontalConnectionPos {\n  return v === 'start' || v === 'end' || v === 'center';\n}","tryCatchPattern":"try {\n  overlayRef = overlay.create({ positionStrategy: overlay.position().flexibleConnectedTo(origin).withPositions(positions) });\n} catch (e) {\n  if ((e as Error).message.includes('Expected \"start\", \"end\" or \"center\"')) {\n    console.error('Fix originX/overlayX values');\n  } else { throw e; }\n}","preventionTips":["Use logical values 'start'/'end' rather than 'left'/'right'.","Annotate positions as ConnectedPosition[] to catch bad literals at build time.","Normalize any config values through a mapper before constructing strategies.","Add unit tests enumerating all configured position combinations."],"tags":["angular","cdk","overlay","positioning"],"backgroundTag":"invalid-position-value","analyzedSha":"0411926e7d8ae06b32236ec1048a888cfad5abf2","analyzedAt":"2026-08-31T11:58:23.400Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}