Index: src/wp-admin/includes/file.php
===================================================================
--- src/wp-admin/includes/file.php	(revision 60000)
+++ src/wp-admin/includes/file.php	(working copy)
@@
 function request_filesystem_credentials( $form_post, $type = '', $error = false, $context = false, $extra_fields = null ) {
 	require_once ABSPATH . 'wp-admin/includes/template.php';
 
 	if ( empty( $type ) ) {
 		$type = get_filesystem_method( array(), $context );
 	}
 
-	// Check if we can write to the context directory.
-	if ( 'direct' === $type && ! is_writable( $context ) ) {
-		$error = true;
-	}
+	// Consistent permissions check: ensure context is valid and writable for direct method.
+	if ( 'direct' === $type ) {
+		if ( empty( $context ) || ! file_exists( $context ) || ! is_dir( $context ) || ! is_writable( $context ) ) {
+			$error = true;
+		}
+	}
 
 	$credentials = array();
 
 	if ( $error ) {
 		// Prompt for credentials.
 		wp_admin_css( 'install', true );
